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?
creating array from line of text
Moderator: General Moderators
-
someguyhere
- Forum Contributor
- Posts: 181
- Joined: Sun Jul 27, 2008 3:24 pm
-
someguyhere
- Forum Contributor
- Posts: 181
- Joined: Sun Jul 27, 2008 3:24 pm
Re: creating array from line of text
NM
explode
explode
-
indian98476
- Forum Commoner
- Posts: 78
- Joined: Tue Dec 15, 2009 3:24 am
Re: creating array from line of text
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...
$goingtoexplode = "item1|item2|item3|item4";
$exploded = explode("|", $goingtoexplode);
//to print the values
echo $exploded[0]; //item1
echo $exploded[1]; //item2 and so on...