Solved

Create Array Based on Delimiter

Posted on 2009-04-01
2
237 Views
Last Modified: 2013-12-12
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.
0
Comment
Question by:deharvy
  • 2
2 Comments
 
LVL 12

Accepted Solution

by:
alien109 earned 500 total points
ID: 24046276
$array = explode("apples oranges peaches bread", " ");
0
 
LVL 12

Expert Comment

by:alien109
ID: 24046281
oops clicked submit before I wanted. It's actually reversed from that :) sorry.

$array = explode("", "apples oranges peaches bread");
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question