Re: [PHP] Re: Split()

2004-02-17 Thread Adam Bregenzer
On Tue, 2004-02-17 at 13:01, John Taylor-Johnston wrote: > $tempauthors = explode("\r\n", $mydata->AuthorList); > foreach ($tempauthors as $singleauthor) > # while($tempauthors = each($singleauthor)) > { > echo "http://www.foo.org$singleauthor\";>$singleauthor "; > } First of all, you ar

Re: [PHP] Re: Split()

2004-02-17 Thread John Taylor-Johnston
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

Re: [PHP] Re: Split()

2004-02-17 Thread John W. Holmes
From: "John Taylor-Johnston" <[EMAIL PROTECTED]> > 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 "http://www.foo.org$singleslice\";>$singleslice "; > } > > Still learning :

Re: [PHP] Re: split on whitespace, preserving whitespace... (a rephrase of the question)

2001-07-20 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Garth Dahlstrom) wrote: > > $sometext2split = "hello world witha lot ofwhitespaces!"; > > $myarray = preg_split ("/\s+/",$sometext2split); > > > > you should get > > $myarray := ['hello', 'world', 'with', 'a', 'lot', 'of', 'whitespa

Re: [PHP] Re: split on whitespace, preserving whitespace... (a rephrase of the question)

2001-07-20 Thread Stefan Rusterholz
m: "Garth Dahlstrom" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, July 20, 2001 4:13 PM Subject: Re: [PHP] Re: split on whitespace, preserving whitespace... (a rephrase of the question) > On Fri, 20 Jul 2001 15:34:48 +0200 "Stefan

Re: [PHP] Re: split on whitespace, preserving whitespace...

2001-07-20 Thread Garth Dahlstrom
t; > > > > [This contanswhite space .][This contanswhite space > .] > > > Are you running php >= 4.0.5? > > jack > -Original Message- > From: Garth Dahlstrom [mailto:[EMAIL PROTECTED]] > Sent: Friday, July 20, 2001 10:06 AM > To: [EMA

Re: [PHP] Re: split on whitespace, preserving whitespace... (a rephrase of the question)

2001-07-20 Thread Garth Dahlstrom
On Fri, 20 Jul 2001 15:34:48 +0200 "Stefan Rusterholz" wrote: > If you'r using PHP >4 use preg_split. (works also with php 3 >= 3.09) > see http://www.php.net/manual/en/function.preg-split.php for detailed > information. > The split pattern you'd need is: > $sometext2split = "hello world with

Re: [PHP] Re: split on whitespace, preserving whitespace...

2001-07-20 Thread Garth Dahlstrom
On Fri, 20 Jul 2001 09:32:00 -0400 "Jack Dempsey" wrote: > > $text = "This contanswhite space ."; > $matches = preg_split("/(\s+)/",$text,-1, PREG_SPLIT_DELIM_CAPTURE); > echo implode('',$matches); Nope that doesn't do it. here's the test: echo "[$text][". implode('',$matches)."]"; here

Re: [PHP] Re: split on whitespace, preserving whitespace...

2001-07-20 Thread Stefan Rusterholz
in the text... > > best regards > Stefan Rusterholz, [EMAIL PROTECTED] > > > - Original Message ----- > From: "Stefan Rusterholz" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, July 20, 2001 3:34 PM > Subject

RE: [PHP] Re: split on whitespace, preserving whitespace...

2001-07-20 Thread Jack Dempsey
AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: split on whitespace, preserving whitespace... Uuhmm, I'm sorry. I haven't read it throught to the end. The solution ist a bit different: use preg_replace to replace multiple spaces with single spaces: $sometext2split = preg_replace("|&q

Re: [PHP] Re: split on whitespace, preserving whitespace...

2001-07-20 Thread Stefan Rusterholz
TED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, July 20, 2001 3:34 PM Subject: Re: [PHP] Re: split on whitespace, preserving whitespace... > If you'r using PHP >4 use preg_split. (works also with php 3 >= 3.09) > see http://www.php.net/manual/e

RE: [PHP] Re: split on whitespace, preserving whitespace...

2001-07-20 Thread Jack Dempsey
$text = "This contanswhite space ."; $matches = preg_split("/(\s+)/",$text,-1, PREG_SPLIT_DELIM_CAPTURE); echo implode('',$matches); try that jack -Original Message- From: Garth Dahlstrom [mailto:[EMAIL PROTECTED]] Sent: Friday, July 20, 2001 7:45 AM To: [EMAIL PROTECTED] Cc: [E

Re: [PHP] Re: split on whitespace, preserving whitespace...

2001-07-20 Thread Stefan Rusterholz
If you'r using PHP >4 use preg_split. (works also with php 3 >= 3.09) see http://www.php.net/manual/en/function.preg-split.php for detailed information. The split pattern you'd need is: $sometext2split = "hello world witha lot ofwhitespaces!"; $myarray = preg_split ("/\s+/",$sometext2s