php - Save SQL column value to an array -
i want save value array. have column called numbers
values 1,2,3
.
if select value, save variable $value
, try put array:
$array = array($value);
but not working properly.
php not automatically convert strings integers. dump showed 1 string, this:
// separate comma array $array = explode("," $str); // array( '1', '2', '3' ); // re-create array, converting strings integers foreach ($array $index => $value) { $array[$index] = (int)$value; }
Comments
Post a Comment