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.

1 Answer 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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.