php array

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Mr.LLB

Thread Starter
Joined
May 27, 2008
Messages
289
hi guys

trying to seperate a string into array but can't think

PHP:
$string="perri~1~returned~today?";
$organizer=array("Name","QTY","Status","when");

//i want the array to be like:

//$data[0][NAME]="perri";
//$data[0][QTY]="1";
//$data[0][Status]="returned";
//$data[0][when]="today";

//and then $data[1] ....
?>
so i want to use the organizer array as sub-array keys and then use the string as values for those sub-array keys
 

colinsp

Colin
Joined
Sep 5, 2007
Messages
2,355
Use the explode command to break up your string into an array.

Probably something like

Code:
$data = explode ("~", $string);
That will store each of the items in $string in their own $data array element you will then need to put them into your organizer array.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top