#39853 [Com]: strtoupper(), strtolower() function can not work with preg_replace $1 vars

From: Date: Sat, 16 Dec 2006 12:40:45 +0000
Subject: #39853 [Com]: 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-106424@lists.php.net to get a copy of this message
ID: 39853 Comment by: ara at lenta dot ru Reported By: anton dot kirsanov at gmail dot com Status: Open Bug Type: Strings related Operating System: Windows XP SP2 PHP Version: 4.4.4 New Comment: Tu XYu. Previous Comments: ------------------------------------------------------------------------ [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; ------------------------------------------------------------------------ [2006-12-16 12:33:44] anton dot kirsanov at gmail dot com Description: ------------ strtoupper(), strtolower() function does not change string(as virtual vars - like $1(\\1)) what be returned a preg_replace function. Reproduce code: --------------- <?php // 1 $s = "A-B"; echo preg_replace("/\-([a-z])/iU", strtolower("$1"), $s); echo "\n"; // 2 $s = "a-b"; echo preg_replace("/\-([a-z])/iU", strtoupper("$1"), $s); // 3 $s = "B-B"; echo preg_replace("/([a-z]-[a-z])/i", strtolower("A-$1-A"), $s); ?> Expected result: ---------------- AB ab a-B-B-a Actual result: -------------- Ab aB abba ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39853&edit=1

« previous php.bugs (#106424) next »