Try:
$str = array(1,2,3,4,5);
Otherwise, if you mean that your input is "1,2,3,4,5", then use explode:
$str = explode(',', '1,2,3,4,5');
In both cases, the output is print_r ($ str); :
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )
source share