[Solved] How to put PHP variable in array


If you want a string instead of an array of numbers, you can use the join method http://php.net/manual/en/function.join.php.

 $str = join(',', array(1, 2, 3));

If you are wanting to create an array out of a string like ‘1,2,3’ you could use the explode method http://php.net/manual/en/function.explode.php.

$arr = explode(",", "1,2,3");

solved How to put PHP variable in array