Create Array Based on Delimiter

I have a line that will output like this:

apples oranges peaches bread

I want to be able to use the values as an array based on the space delimiter " ".

printf($array[0]);
printf($array[2]);

The above prints should output something like this: apples oranges

I'm way off; I know; but hope you can help.
deharvyAsked:
Who is Participating?
 
alien109Commented:
$array = explode("apples oranges peaches bread", " ");
0
 
alien109Commented:
oops clicked submit before I wanted. It's actually reversed from that :) sorry.

$array = explode("", "apples oranges peaches bread");
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.