#33378 [Opn->Bgs]: The explode() function doesn't work properly when using "+" as the separator
| From: | helly@php.net | Date: | Fri, 17 Jun 2005 07:49:46 +0000 |
| Subject: | #33378 [Opn->Bgs]: The explode() function doesn't work properly when using "+" as the separator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80512@lists.php.net to get a copy of this message | ||
ID: 33378
Updated by: helly@php.net
Reported By: mbrown at dxsonline dot com
-Status: Open
+Status: Bogus
Bug Type: Output Control
-Operating System: Windows XP Service Pack 2
+Operating System: *
PHP Version: 5.0.4
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
Works like a charne:
$ php -r 'var_dump(explode("+", "1+2+3+4"));'
array(4) {
[0]=>
string(1) "1"
[1]=>
string(1) "2"
[2]=>
string(1) "3"
[3]=>
string(1) "4"
}
Since your output does not contain the '+' sign you obviously executed
the code through a browser in which case the output is absolutley
exected since the '+' are converted to spaces before your script sees
them.
Previous Comments:
------------------------------------------------------------------------
[2005-06-17 05:02:50] mbrown at dxsonline dot com
Description:
------------
The explode() function will not properly separate strings that are
separated by plus signs (+). It will put all of the string into the
first array element separated by spaces.
Reproduce code:
---------------
$toExplode = "1+1+1+1";
$exploded = explode("+", $toExplode);
foreach($exploded as $e) {
echo "Bug: ".$e."<br />"; }
Expected result:
----------------
Bug: 1
Bug: 1
Bug: 1
Bug: 1
Actual result:
--------------
Bug: 1 1 1 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33378&edit=1