ID: 40863 User updated by: jonathan at sadowski dot us Reported By: jonathan at sadowski dot us -Status: Bogus +Status: Open Bug Type: Strings related Operating System: Ubuntu PHP Version: 5.2.1 New Comment:
Perhaps you should read the expected result before marking it bogus, and read through the sample code to see what its supposed to do. The first word is "We", this cannot produce "GG" no matter what, as "W" and "e" are two different words. Previous Comments: ------------------------------------------------------------------------ [2007-03-20 10:20:15] [EMAIL PROTECTED] ..E .. W ..W .. G E replaced with W W replaced with G. ------------------------------------------------------------------------ [2007-03-20 10:10:33] jonathan at sadowski dot us Description: ------------ str_ireplace doesn't behave as expected when $search and $replace are equally sized arrays, and $subject is a string containing mixed case. Reproduce code: --------------- <?php $phrase = "We the People of the United States"; $letters = explode(" ","A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); $key = $letters; shuffle($key); echo sizeof($letters) . "\n" . sizeof($key) . "\n\n"; echo implode(" ",$letters) . "\n" . implode(" ",$key) . "\n" . str_ireplace($letters,$key,$phrase); ?> Expected result: ---------------- 26 26 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z V T U O W Q E X Y K S D Z B M A I L J R C F G H P N GW RXW AWMADW MQ RXW CBYRWO JRVRWJ Actual result: -------------- 26 26 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z V T U O W Q E X Y K S D Z B M A I L J R C F G H P N GG RHG AGMADG MI RHG CBPRGM JRFRGJ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40863&edit=1