Req #52362 [Com]: give str_ireplace an option to refer the original string

From: Date: Fri, 16 Jul 2010 12:21:29 +0000
Subject: Req #52362 [Com]: give str_ireplace an option to refer the original string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152480@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 Comment by: giorgio dot liscio at email dot it 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: use preg_replace with /i PCRE_CASELESS identifier bogus Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#152480) next »