Solved

Create Array Based on Delimiter

Posted on 2009-04-01
2
215 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now