Reputation: 944
I am trying to store a few variables (numbers) that are in a single string, in an array. Like, if I would use something like
"1 0 0 1 1 0 0 1 1"
to store every single number in an array, like:
numbers[i];
I am sure there is a PHP function for this, help is appreciated.
Upvotes: 0
Views: 76
Reputation: 3731
You should be able to use $numbers = explode(' ', $string);
. This will create an array based on the spaces as a separator.
More info here: http://www.php.net/manual/en/function.explode.php
Upvotes: 7