Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Create Array Based on Delimiter

Posted on 2009-04-01
2
Medium Priority
?
269 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

879 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