More newbie problems -- this time regexp and split

From: Date: Tue, 05 Sep 2000 05:42:22 +0000
Subject: More newbie problems -- this time regexp and split
Groups: php.general 
Request: Send a blank email to php-general+get-15232@lists.php.net to get a copy of this message
The browser returns a bunch of email addresses (one or more) entered into a textarea block, separated by commas and/or whitespace. I try to split it and I get the first element repeated by itself up to limit-1, and the last element of the resulting array contains all the elements. To try and figure out what's wrong, I took a basic example from the WROX PHP book: $str = "one two three four"; $pat = " "; $array = split($pat, $str, 4); print "$array[0]<BR>\n"; print "$array[1]<BR>\n"; print "$array[2]<BR>\n"; print "$array[3]<BR>\n"; And this is what appears on the WEB page: one one one one two three four According to the book, I should see: one two three four So what's wrong? Thanks for your patience with this newbie. -- Rob
      _ _ _ _           _    _ _ _ _ _
     /\_\_\_\_\        /\_\ /\_\_\_\_\_\
    /\/_/_/_/_/       /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
   /\/_/__\/_/ __    /\/_/    /\/_/          PROFUNDUM VIDITUR
  /\/_/_/_/_/ /\_\  /\/_/    /\/_/
 /\/_/ \/_/  /\/_/_/\/_/    /\/_/         (Whatever is said in Latin
 \/_/  \/_/  \/_/_/_/_/     \/_/              appears profound)
Rob Tanner McMinnville, Oregon rtanner@onlinemac.com

« previous php.general (#15232) next »