#24784 [Opn->Asn]: str_replace count paramater only counts replacements when strlen > 1
| From: | sniper@php.net | Date: | Thu, 24 Jul 2003 13:07:16 +0000 |
| Subject: | #24784 [Opn->Asn]: str_replace count paramater only counts replacements when strlen > 1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-44664@lists.php.net to get a copy of this message | ||
ID: 24784
Updated by: sniper@php.net
Reported By: philip at cornado dot com
-Status: Open
+Status: Assigned
Bug Type: Strings related
Operating System: linux
PHP Version: 5CVS-2003-07-23 (dev)
-Assigned To:
+Assigned To: pollita
New Comment:
Sara, you added it, fix it. :)
Previous Comments:
------------------------------------------------------------------------
[2003-07-23 21:23:31] philip@php.net
Actual result is 0. The bug database didn't allow 0 as an actual or
expected result value, but does now :)
------------------------------------------------------------------------
[2003-07-23 21:14:27] philip at cornado dot com
Description:
------------
str_[i]replace() has a count parameter that returns a variable (by
reference) with a count of replacements. This is not counting when the
search string is one character in length.
Reproduce code:
---------------
<?php
$count = 0;
$str = str_replace('a', '', 'apples are good', $count);
echo $count;
?>
Expected result:
----------------
2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24784&edit=1