3v4l.org

run code in 200+ PHP versions simultaneously
<?php $str = 'I loved you'; $from = 'love'; $to = 'lOvE'; var_dump($result1 = strtr($str, $from, $to)); var_dump($result2 = strtr($str, [$from[0] => $to[0], $from[1] => $to[1], $from[2] => $to[2], $from[3] => $to[3]])); var_dump($result2 = strtr($str, [$from => $to])); var_dump($result1===$result2);//false
Output for 7.0.0 - 7.4.0
string(11) "I lOvEd yOu" string(11) "I lOvEd yOu" string(11) "I lOvEd you" bool(false)