PDA

View Full Version : explode();


Davey
03-05-2003, 02:32 PM
I can't understand where explode(); gets its data from O.o.
Ex:$variable=explode(";", $variable2);
Then I guess you use $variable2=array();
Or not?
I just can't quite understand how it works, could someone explain it please?
Ty.

Dave.

filburt1
03-05-2003, 02:40 PM
$myarray = explode(" ", "one two three four five");

foreach ($myarray as $s)
{
echo "$s<br>";
}

That will echo:

one
two
three
four
five

implode() does the opposite by making an array into a string.

Davey
03-06-2003, 02:10 PM
I just about get that so I'll bookmark it as a resource.
Thanks filburt.

Dave.