Re: split string

From: Date: Fri, 11 May 2001 19:06:11 +0000
Subject: Re: split string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52503@lists.php.net to get a copy of this message
On Fri, May 11, 2001 at 10:24:02AM -0500, Jacky wrote: > I got series of string value like this 1,2,3. And the seires are > dynamic dynamaic, which means it is not always 1,2,3 but could be > more, but always in this format that is separated by "," . How do I > pick each of value in the series and assign it into new vairiable, > like from: > $test = 1,2,3; > and assign to be > $test =1; > $test1=2; > $test2 =3; > Is theer any function that could help me with that? because I need to > update table using those value but I cannot use series of value to > update, have to break them down to each variable like that. Use arrays. $test = "1,2,3"; $test = explode(",", $test); // $test[0] == "1"; // $test[1] == "2"; // $test[2] == "3"; -- Jason Stechschulte jpstech@unoh.edu -- Well, that's more-or-less what I was saying, though obviously addition is a little more cosmic than the bitwise operators. -- Larry Wall in <199709051808.LAA01780@wall.org>

« previous php.general (#52503) next »