ID:               28755
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ekitten-listed at comcast dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         *Regular Expressions
 Operating System: Linux
 PHP Version:      4.3.6
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Your scrupt is wrong, [,]+ will also match ",," and that will be used
to split your script, and not two single ","'s.


Previous Comments:
------------------------------------------------------------------------

[2004-06-12 15:56:08] ekitten-listed at comcast dot net

Description:
------------
If I call preg_split with a string such as ",,foo,,bar,," I expect to
get five empty strings back in the returned array, but I only get back
two - the first and the last.

Reproduce code:
---------------
$tokens = preg_split("/[,]+/", ",,foo,,bar,,");

Expected result:
----------------
I expect $tokens to contain the following array:

array(12) {
  [0]=>  string(0) ""
  [1]=>  string(0) ""
  [2]=>  string(3) "foo"
  [3]=>  string(0) ""
  [4]=>  string(3) "bar"
  [5]=>  string(0) ""
  [6]=>  string(0) ""
}


Actual result:
--------------
array(12) {
  [0]=>  string(0) ""
  [1]=>  string(3) "foo"
  [2]=>  string(3) "bar"
  [3]=>  string(0) ""
}



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28755&edit=1

Reply via email to