#39853 [Opn->Bgs]: strtoupper(), strtolower() function can not work with preg_replace $1 vars

From: Date: Sun, 17 Dec 2006 13:11:01 +0000
Subject: #39853 [Opn->Bgs]: strtoupper(), strtolower() function can not work with preg_replace $1 vars
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106433@lists.php.net to get a copy of this message
ID: 39853 Updated by: tony2001@php.net Reported By: anton dot kirsanov at gmail dot com -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Windows XP SP2 PHP Version: 4.4.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 Previous Comments: ------------------------------------------------------------------------ [2006-12-16 20:48:37] anton dot kirsanov at gmail dot com Hi:) funny... you will use "/e" modifier if you want parse the pattern as a php code. Say me, why a function str_repeat() really work in this situation: <?php $s = "A-B"; echo preg_replace("/\-([a-z])/iU", str_repeat("$1", 10), $s); ?> // -------------- // ACTUAL RESULT: // -------------- ABBBBBBBBBB Why? See that: <?php $s = "A-B"; echo preg_replace("/\-([a-z])/iU", strtolower(str_repeat("$1", 10)), $s); ?> // -------------- // ACTUAL RESULT: // -------------- ABBBBBBBBBB // Why that ? :) ------------------------------------------------------------------------ [2006-12-16 18:09:15] judas dot iscariote at gmail dot com Why you think this is a bug ? you are looking for preg_replace_callback ... or if you are crazy, the preg_replace "/e" modifier. not a bug, read the manual ;-) ------------------------------------------------------------------------ [2006-12-16 12:40:44] ara at lenta dot ru Tu XYu. ------------------------------------------------------------------------ [2006-12-16 12:37:46] anton dot kirsanov at gmail dot com Sorry, am mix up a 'Expected result' and 'Actual result' :) Please read this quite the contrary - 'Expected result' is a 'Actual result'. ------------------------------------------------------------------------ [2006-12-16 12:35:36] ara at lenta dot ru &#1090;&#1099; &#1093;&#1091;&#1081; ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/39853 -- Edit this bug report at http://bugs.php.net/?id=39853&edit=1

« previous php.bugs (#106433) next »