Re: Split()
| From: | John Taylor-Johnston | Date: | Tue, 17 Feb 2004 16:12:13 +0000 |
| Subject: | Re: Split() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177967@lists.php.net to get a copy of this message | ||
I can do this, but want to understand how to while it: Or should I?
$tempslices = explode("\r\n", $pizza);
foreach ($tempslices as $singleslice)
{
echo "<a href=\"http://www.foo.org$singleslice\">$singleslice</a>
";
}
Still learning :)
John Taylor-Johnston wrote:
> Can I while this? Not sure how to go about it?
>
> while ($pieces exist) {
> echo $pieces[i];
> }
>
> Thanks,
> John
>
> $pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
> $pieces = explode(" ", $pizza);
> echo $pieces[0]; // piece1
> echo $pieces[1]; // piece2
>
> http://www.php.net/manual/en/function.explode.php
> http://www.php.net/manual/en/control-structures.while.php