3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text = str_repeat( 'm', 2000 ); $long_from_a = str_repeat( 'a', 1 ); $long_from_x = str_repeat( 'x', 1500 ); $replacements = array( $long_from_a => 'b', $long_from_x => 'y' ); $start = microtime( true ); $result_1 = strtr( $text, $replacements ); echo "strtr: " . number_format( microtime( true ) - $start, 4 ) . "\n"; $start = microtime( true ); $result_2 = str_replace( array_keys( $replacements ), array_values( $replacements ), $text ); echo "str_replace: " . number_format( microtime( true ) - $start, 4 ) . "\n"; echo $result_1 === $result_2 ? "results match!\n": "no match!\n";
Output for 5.4.24 - 5.4.25, 5.4.27, 5.4.29 - 5.4.30, 5.4.34 - 5.4.35, 5.5.33 - 5.5.34, 5.6.8, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
strtr: 0.0000 str_replace: 0.0000 results match!
Output for 5.4.12 - 5.4.23, 5.4.26, 5.4.28, 5.4.31 - 5.4.32, 5.4.36 - 5.5.32, 5.5.35, 5.6.9 - 5.6.28
strtr: 0.0001 str_replace: 0.0000 results match!
Output for 5.4.11
strtr: 1.3550 str_replace: 0.0000 results match!
Output for 5.4.10
strtr: 1.3185 str_replace: 0.0000 results match!
Output for 5.4.9
strtr: 1.2454 str_replace: 0.0000 results match!
Output for 5.4.8
strtr: 1.2483 str_replace: 0.0000 results match!
Output for 5.4.7
strtr: 1.3448 str_replace: 0.0000 results match!
Output for 5.4.6
strtr: 1.3804 str_replace: 0.0000 results match!
Output for 5.4.5
strtr: 1.2191 str_replace: 0.0000 results match!
Output for 5.4.4
strtr: 1.2820 str_replace: 0.0000 results match!
Output for 5.4.0, 5.4.3
strtr: 1.3329 str_replace: 0.0000 results match!
Output for 5.4.2
strtr: 1.2838 str_replace: 0.0000 results match!
Output for 5.4.1
strtr: 1.2736 str_replace: 0.0000 results match!
Output for 5.3.29
strtr: 0.7935 str_replace: 0.0000 results match!
Output for 5.3.28
strtr: 0.8706 str_replace: 0.0000 results match!
Output for 5.3.27
strtr: 1.2651 str_replace: 0.0000 results match!
Output for 5.3.26
strtr: 1.3892 str_replace: 0.0000 results match!
Output for 5.3.25
strtr: 1.3273 str_replace: 0.0000 results match!
Output for 5.3.24
strtr: 1.2861 str_replace: 0.0000 results match!
Output for 5.3.23
strtr: 1.2635 str_replace: 0.0000 results match!
Output for 5.3.22
strtr: 1.3213 str_replace: 0.0000 results match!
Output for 5.3.21
strtr: 1.2414 str_replace: 0.0000 results match!
Output for 5.3.20
strtr: 1.2786 str_replace: 0.0000 results match!
Output for 5.3.19
strtr: 1.2209 str_replace: 0.0000 results match!
Output for 5.3.18
strtr: 1.3541 str_replace: 0.0000 results match!
Output for 5.3.17
strtr: 1.3335 str_replace: 0.0000 results match!
Output for 5.3.16
strtr: 1.2144 str_replace: 0.0000 results match!
Output for 5.3.15
strtr: 1.2519 str_replace: 0.0000 results match!
Output for 5.3.14
strtr: 1.2738 str_replace: 0.0000 results match!
Output for 5.3.13
strtr: 1.2527 str_replace: 0.0000 results match!
Output for 5.3.12
strtr: 1.4192 str_replace: 0.0000 results match!
Output for 5.3.11
strtr: 1.2752 str_replace: 0.0000 results match!
Output for 5.3.10
strtr: 1.2458 str_replace: 0.0000 results match!
Output for 5.3.9
strtr: 1.3600 str_replace: 0.0000 results match!
Output for 5.3.2, 5.3.8
strtr: 1.4656 str_replace: 0.0000 results match!
Output for 5.3.7
strtr: 1.4452 str_replace: 0.0000 results match!
Output for 5.3.6
strtr: 1.4586 str_replace: 0.0000 results match!
Output for 5.3.5
strtr: 1.4581 str_replace: 0.0000 results match!
Output for 5.3.4
strtr: 1.4408 str_replace: 0.0000 results match!
Output for 5.3.3
strtr: 1.4743 str_replace: 0.0000 results match!
Output for 5.3.1
strtr: 1.4958 str_replace: 0.0001 results match!
Output for 5.3.0
strtr: 1.4782 str_replace: 0.0000 results match!
Output for 5.2.17
strtr: 1.4838 str_replace: 0.0000 results match!
Output for 5.2.16
strtr: 1.4400 str_replace: 0.0000 results match!
Output for 5.2.15
strtr: 1.4885 str_replace: 0.0000 results match!
Output for 5.2.14
strtr: 1.4653 str_replace: 0.0000 results match!
Output for 5.2.13
strtr: 1.4498 str_replace: 0.0000 results match!
Output for 5.2.12
strtr: 1.4665 str_replace: 0.0000 results match!
Output for 5.2.11
strtr: 1.4676 str_replace: 0.0000 results match!
Output for 5.2.10
strtr: 1.5011 str_replace: 0.0000 results match!
Output for 5.2.9
strtr: 1.4549 str_replace: 0.0000 results match!
Output for 5.2.8
strtr: 1.4861 str_replace: 0.0000 results match!
Output for 5.2.7
strtr: 1.5420 str_replace: 0.0000 results match!
Output for 5.2.6
strtr: 1.2002 str_replace: 0.0000 results match!
Output for 5.2.5
strtr: 1.2042 str_replace: 0.0000 results match!
Output for 5.2.4
strtr: 1.2031 str_replace: 0.0000 results match!
Output for 5.2.3
strtr: 1.4166 str_replace: 0.0000 results match!
Output for 5.2.2
strtr: 1.6113 str_replace: 0.0000 results match!
Output for 5.2.1
strtr: 1.2113 str_replace: 0.0000 results match!
Output for 5.2.0
strtr: 1.1998 str_replace: 0.0000 results match!
Output for 5.1.6
strtr: 1.2035 str_replace: 0.0000 results match!
Output for 5.1.5
strtr: 1.2766 str_replace: 0.0000 results match!
Output for 5.1.4
strtr: 1.1935 str_replace: 0.0000 results match!
Output for 5.1.3
strtr: 1.2044 str_replace: 0.0000 results match!
Output for 5.1.2
strtr: 0.9320 str_replace: 0.0000 results match!
Output for 5.1.1
strtr: 0.9177 str_replace: 0.0000 results match!
Output for 5.1.0
strtr: 0.8984 str_replace: 0.0000 results match!
Output for 5.0.5
strtr: 0.9210 str_replace: 0.0000 results match!
Output for 5.0.4
strtr: 0.9217 str_replace: 0.0000 results match!
Output for 5.0.3
strtr: 0.8924 str_replace: 0.0000 results match!
Output for 5.0.2
strtr: 0.8644 str_replace: 0.0000 results match!
Output for 5.0.1
strtr: 0.8613 str_replace: 0.0000 results match!
Output for 5.0.0
strtr: 0.9000 str_replace: 0.0000 results match!
Output for 4.4.9
strtr: 0.0586 str_replace: 0.0000 results match!
Output for 4.4.8
strtr: 0.0660 str_replace: 0.0000 results match!
Output for 4.4.7
strtr: 0.0746 str_replace: 0.0000 results match!
Output for 4.4.6
strtr: 0.0443 str_replace: 0.0000 results match!
Output for 4.4.5
strtr: 0.0079 str_replace: 0.0000 results match!
Output for 4.4.4
strtr: 0.0795 str_replace: 0.0000 results match!
Output for 4.4.3
strtr: 0.0352 str_replace: 0.0000 results match!
Output for 4.4.2
strtr: -0.9306 str_replace: 0.0000 results match!
Output for 4.4.1
strtr: 0.0508 str_replace: 0.0000 results match!
Output for 4.4.0
strtr: 0.0680 str_replace: 0.0000 results match!
Output for 4.3.11
strtr: 0.0286 str_replace: 0.0000 results match!
Output for 4.3.10
strtr: 0.0054 str_replace: 0.0000 results match!
Output for 4.3.9
strtr: 0.0570 str_replace: 0.0000 results match!
Output for 4.3.8
strtr: 0.0619 str_replace: 0.0000 results match!
Output for 4.3.7
strtr: 0.0621 str_replace: 0.0000 results match!
Output for 4.3.6
strtr: 0.0707 str_replace: 0.0000 results match!
Output for 4.3.5
strtr: 0.0367 str_replace: 0.0000 results match!
Output for 4.3.4
strtr: 0.0254 str_replace: 0.0000 results match!
Output for 4.3.3
strtr: 0.0155 str_replace: 0.0000 results match!
Output for 4.3.2
strtr: 0.0495 str_replace: 0.0000 results match!
Output for 4.3.1
strtr: 0.0333 str_replace: 0.0000 results match!
Output for 4.3.0
strtr: -0.9289 str_replace: 0.0000 results match!