--TEST-- Test strtr() function : usage variations - regular & numeric strings for 'str' argument --FILE-- "a", "a" => 1, "2b3c" => "b2c3", "b2c3" => "3c2b"); /* loop through to test strtr() with each element of $str_arr */ for($index = 0; $index < count($str_arr); $index++) { echo "-- Iteration $count --\n"; $str = $str_arr[$index]; //getting the $str_arr element in $str variable //strtr() call in three args syntax form var_dump( strtr($str, $from, $to) ); //strtr() call in two args syntax form var_dump( strtr($str, $replace_pairs) ); $count++; } echo "*** Done ***"; ?> --EXPECT-- *** Testing strtr() : numeric & regular double quoted strings *** -- Iteration 1 -- unicode(3) "abc" unicode(3) "a23" -- Iteration 2 -- unicode(3) "123" unicode(3) "1bc" -- Iteration 3 -- unicode(6) "a1b2c3" unicode(6) "a1b2c3" -- Iteration 4 -- unicode(3) "abc" unicode(3) "a23" -- Iteration 5 -- unicode(3) "123" unicode(3) "1bc" -- Iteration 6 -- unicode(6) "a1b2c3" unicode(6) "a1b2c3" -- Iteration 7 -- unicode(14) "abc 123 a1b2c3" unicode(14) "a23 1bc a1b2c3" *** Done ***