|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-09-08 10:33 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2017-09-08 10:33 UTC] requinix@php.net
[2017-09-08 10:33 UTC] kelunik@php.net
[2017-09-08 10:33 UTC] mail at pmmaga dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 12:00:01 2025 UTC |
Description: ------------ In PHP Manual,we can find the message "The replace_pairs parameter may be used instead of to and from, in which case it's an array in the form array('from' => 'to', ...)".In fast,the results are different,it doesn't work as documented. Test script: --------------- <?php $str = 'I loved you'; $from = 'love'; $to = 'lOvE'; var_dump($result1 = strtr($str, $from, $to));//I lOvEd yOu var_dump($result2 = strtr($str, [$from=>$to]));//I lOvEd you var_dump($result1===$result2);//false Expected result: ---------------- I lOvEd you I lOvEd you true Actual result: -------------- I lOvEd yOu I lOvEd you false