Re: Re: Split()

From: Date: Tue, 17 Feb 2004 18:01:23 +0000
Subject: Re: Re: Split()
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-177994@lists.php.net to get a copy of this message
John, Thanks. It's a question of understanding it. I can get a foreach to work, but my while doesn't. >There's no real reason to use while() over foreach(). Why do you think you >need to use while()? Rather than ask people to code for me, I'm trying to spend a little extra time to try and learn first. My foreach works, but not my while (in any combination). $tempauthors = explode("\r\n", $mydata->AuthorList); foreach ($tempauthors as $singleauthor) # while($tempauthors = each($singleauthor)) { echo "<a href=\"http://www.foo.org$singleauthor\">$singleauthor</a> "; } "John W. Holmes" wrote: > From: "John Taylor-Johnston" <taylorjo@collegesherbrooke.qc.ca> > > > 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 :) > > There's no real reason to use while() over foreach(). Why do you think you > need to use while()? > > ---John Holmes...

« previous php.general (#177994) next »