Use PHP’s explode.
1 2 3 4 5 6 7 |
$str = "1,2,3,4,5,6"; $arr = explode("," $str); // array( '1', '2', '3', '4', '5', '6' ); foreach ($arr AS $index => $value) $arr[$index] = (int)$value; // casts each value to integer type -- array( 1, 2, 3, 4, 5, 6 ); |
1 |
array_walk($arr, 'intval'); |
.