Req #52362 [Opn->Wfx]: give str_ireplace an option to refer the original string
| From: | aharvey@php.net | Date: | Mon, 19 Jul 2010 09:45:47 +0000 |
| Subject: | Req #52362 [Opn->Wfx]: give str_ireplace an option to refer the original string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152520@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52362&edit=1
ID: 52362
Updated by: aharvey@php.net
Reported by: emiobe at guehring dot de
Summary: give str_ireplace an option to refer the original string
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: *General Issues
PHP Version: 5.3.2
New Comment:
The point of having the separate str_replace and str_ireplace functions
is that they're intended to be fast replacers for times when you don't
need any special features such as regular expression matching or back
references. This would introduce special case code that would only slow
them down and duplicate functionality the preg functions provide.
Previous Comments:
------------------------------------------------------------------------
[2010-07-16 14:31:32] emiobe at guehring dot de
erm, just replace expected and actual result... I have mixed it up,
sorry
------------------------------------------------------------------------
[2010-07-16 14:21:28] giorgio dot liscio at email dot it
use preg_replace with /i PCRE_CASELESS identifier
bogus
------------------------------------------------------------------------
[2010-07-16 14:13:21] emiobe at guehring dot de
Description:
------------
Currently I can search case-insensitive with str_ireplace. But when I
need the original string in the replacement I have to use
preg_replace//i.
It would be nice to have the original text in a "magic variable" like $1
to avoid using the "expensive" preg-engine.
Test script:
---------------
currently:
print str_ireplace ("original", "<b>original</b>", "the
ORIGINAL
text");
idea:
print str_ireplace ("original", "<b>$1</b>", "the ORIGINAL
text");
Expected result:
----------------
the <b>original</b> text
Actual result:
--------------
the <b>ORIGINAL</b> text
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52362&edit=1