I know how to take 123, 124, 125 to an array but unable to find how to take a single string and explode that into an array.
Your help is appreciated.
Moderator: General Moderators
Code: Select all
$string = "123456";
$array = explode("\1\2\3",chunk_split($string, 1, "\1\2\3"));
print_r($array);
// Output: Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => )