Edit report at http://bugs.php.net/bug.php?id=52362&edit=1
ID: 52362
User updated by: emiobe at guehring dot de
Reported by: emiobe at guehring dot de
Summary: give str_ireplace an option to refer the original
string
Status: Open
Type: Feature/Change Request
Package: *General Issues
PHP Version: 5.3.2
New Comment:
erm, just replace expected and actual result... I have mixed it up,
sorry
Previous Comments:
------------------------------------------------------------------------
[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