RE: [PHP] Divide into words

From: Date: Mon, 16 Dec 2002 17:47:00 +0000
Subject: RE: [PHP] Divide into words
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128437@lists.php.net to get a copy of this message
True, but it answers the original question. :) You can easily throw in a if($word == ' ') then don't save it, but still increment $pos. You could use a regular expression to check/remove punctuation, too. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ > -----Original Message----- > From: Marco Tabini [mailto:marcot@inicode.com] > Sent: Monday, December 16, 2002 12:37 PM > To: holmes072000@charter.net > Cc: 'Uros Gruber'; PHP-General > Subject: RE: [PHP] Divide into words > > John, > > I'm not sure this will work if there is more than one space between > words. > > Also, my previous example won't work if there are duplicate words > (although it's easy to make an array out of each word and solve the > problem), nor if the words are delimited by any character other than > spaces, in which case regex are probably our best bet. > > Cheers, > > > Marco > -- > ------------ > php|architect - The magazine for PHP Professionals > The monthly worldwide magazine dedicated to PHP programmers > > Come visit us at http://www.phparch.com!

« previous php.general (#128437) next »