0

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.

4

1 に答える 1

7

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

于 2013-03-05T19:06:07.063 に答える