Page 1 of 1

creating array from line of text

Posted: Tue Dec 22, 2009 10:27 pm
by someguyhere
I'm having a tough time figuring out how to take a string of text and turn it into an array. The items are delimited with a pipe; ex:

item1|item2|item3|item4

Can someone point me in the right direction?

Re: creating array from line of text

Posted: Tue Dec 22, 2009 10:30 pm
by someguyhere
NM

explode

Re: creating array from line of text

Posted: Wed Dec 23, 2009 12:21 am
by indian98476
just a small example to get u carrying on....

$goingtoexplode = "item1|item2|item3|item4";
$exploded = explode("|", $goingtoexplode);

//to print the values
echo $exploded[0]; //item1
echo $exploded[1]; //item2 and so on...