3v4l.org

run code in 300+ PHP versions simultaneously
<?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";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.00.0100.00715.18
7.3.120.0100.01014.74
7.3.110.0090.00315.09
7.3.100.0070.01014.61
7.3.90.0090.00615.14
7.3.80.0060.01015.01
7.3.70.0040.01114.63
7.3.60.0030.01014.74
7.3.50.0000.01314.71
7.3.40.0100.00314.87
7.3.30.0030.01015.00
7.3.20.0070.01016.51
7.3.10.0070.00716.77
7.3.00.0060.00916.61
7.2.250.0170.00315.06
7.2.240.0100.00714.81
7.2.230.0000.01514.98
7.2.220.0070.00714.84
7.2.210.0130.00315.34
7.2.200.0040.01215.05
7.2.190.0080.00415.01
7.2.180.0100.00715.05
7.2.170.0060.00615.09
7.2.00.0000.01319.39
7.1.330.0070.00715.69
7.1.320.0060.00915.94
7.1.310.0000.01415.95
7.1.300.0000.01315.72
7.1.290.0030.00715.64
7.1.280.0050.00515.80
7.1.270.0040.01115.90
7.1.260.0000.01215.76
7.1.70.0030.00717.18
7.1.60.0040.00817.17
7.1.50.0080.00317.14
7.1.00.0070.07022.37
7.0.200.0040.01216.82
7.0.140.0030.07322.09
7.0.120.0030.03721.96
7.0.60.0100.03319.85
7.0.50.0000.04017.82
7.0.40.0030.04720.05
7.0.30.0170.04320.04
7.0.20.0430.06720.08
7.0.10.0170.08020.09
7.0.00.0130.07720.18
5.6.280.0070.06720.78
5.6.210.0100.07720.63
5.6.200.0130.06718.10
5.6.190.0100.08320.48
5.6.180.0270.05720.45
5.6.170.0200.06720.47
5.6.160.0100.08320.57
5.6.150.0170.07018.21
5.6.140.0070.07018.12
5.6.130.0030.09018.21
5.6.120.0070.07720.99
5.6.110.0030.08720.98
5.6.100.0070.07320.98
5.6.90.0130.07021.00
5.6.80.0070.06320.43
5.5.350.0270.08320.39
5.5.340.0030.04017.98
5.5.330.0070.04020.28
5.5.320.0230.08020.40
5.5.310.0400.07320.50
5.5.300.0070.04317.95
5.5.290.0100.07718.01
5.5.280.0000.08720.88
5.5.270.0070.07720.69
5.5.260.0130.05720.66
5.5.250.0070.05320.47
5.5.240.0070.06720.05
5.4.450.0270.08019.41
5.4.440.0270.07019.13
5.4.430.0270.07019.54
5.4.420.0270.07319.41
5.4.410.0230.04019.36
5.4.400.0230.06719.07
5.4.390.3470.04019.08
5.4.380.0270.07318.89
5.4.370.0500.05718.81
5.4.360.0330.06318.92
5.4.350.0170.03718.79
5.4.340.0200.04719.16
5.4.320.0300.07019.08
5.4.310.0570.05719.20
5.4.300.0170.03719.08
5.4.290.0270.03718.99
5.4.280.0300.05319.22
5.4.270.0430.04018.92
5.4.260.0230.07718.91
5.4.250.0230.03319.07
5.4.240.0230.03019.23
5.4.230.0300.07019.31
5.4.220.0330.06319.07
5.4.210.0130.05318.72
5.4.200.0130.04718.92
5.4.190.0070.06318.74
5.4.180.0130.05018.87
5.4.170.0030.05718.98
5.4.160.0030.05718.91
5.4.150.0130.07318.86
5.4.140.0070.05016.45
5.4.130.0030.05016.50
5.4.120.0100.04316.41
5.4.110.0071.40716.22
5.4.100.0171.39716.36
5.4.90.0071.43316.24
5.4.80.0001.39716.22
5.4.70.0071.39716.36
5.4.60.0031.38716.42
5.4.50.0101.39716.48
5.4.40.0071.42016.51
5.4.30.0131.38016.20
5.4.20.0231.38716.38
5.4.10.0131.37316.30
5.4.00.0101.40315.82
5.3.290.4000.83014.61
5.3.280.3130.91014.60
5.3.270.0071.52014.38
5.3.260.0131.51714.77
5.3.250.0131.57314.70
5.3.240.0101.51314.50
5.3.230.0071.53314.67
5.3.220.0131.48714.48
5.3.210.0071.50314.34
5.3.200.0101.48014.58
5.3.190.0101.52314.62
5.3.180.0071.48014.64
5.3.170.0101.55314.43
5.3.160.0031.56714.58
5.3.150.0101.49314.64
5.3.140.0071.49714.43
5.3.130.0071.52314.64
5.3.120.0101.50014.71
5.3.110.0101.50014.33
5.3.100.0171.49313.82
5.3.90.0001.58314.18
5.3.80.0131.49014.06
5.3.70.0001.48313.96
5.3.60.0101.48313.92
5.3.50.0101.48713.94
5.3.40.0031.48313.89
5.3.30.0131.48013.82
5.3.20.0171.47713.64
5.3.10.0201.47313.66
5.3.00.0201.50013.60
5.2.170.0101.48311.34
5.2.160.0001.47311.26
5.2.150.0231.48011.15
5.2.140.0101.50311.28
5.2.130.0101.47311.23
5.2.120.0131.46711.28
5.2.110.0171.48311.14
5.2.100.0231.50011.14
5.2.90.0031.48711.23
5.2.80.0171.49011.20
5.2.70.0071.50311.28
5.2.60.0031.49011.02
5.2.50.0101.54310.98
5.2.40.0071.47711.02
5.2.30.0071.49711.19
5.2.20.0031.47311.03
5.2.10.0101.47010.88
5.2.00.0071.48311.03
5.1.60.0031.48710.23
5.1.50.0101.4739.96
5.1.40.0131.5039.96
5.1.30.0101.47310.74
5.1.20.0000.98013.88
5.1.10.0330.97313.88
5.1.00.0370.94713.88
5.0.50.0200.96313.88
5.0.40.0170.96313.88
5.0.30.0100.94013.88
5.0.20.0100.88313.88
5.0.10.1030.88013.88
5.0.00.0170.96013.84
4.4.90.0001.09013.88
4.4.80.0001.09313.88
4.4.70.0001.10713.82
4.4.60.0001.07013.84
4.4.50.0071.02013.91
4.4.40.0001.12713.88
4.4.30.0001.05713.88
4.4.20.0101.10013.84
4.4.10.0131.07313.91
4.4.00.0131.11713.91
4.3.110.0071.04713.88
4.3.100.0031.02313.88
4.3.90.0101.08013.91
4.3.80.0071.11713.90
4.3.70.0071.08013.91
4.3.60.0201.10313.91
4.3.50.0031.05313.88
4.3.40.1531.05013.88
4.3.30.0531.03713.91
4.3.20.0701.06713.91
4.3.10.0731.04713.91
4.3.00.0031.10713.91

preferences:
39.25 ms | 400 KiB | 5 Q