3v4l.org

run code in 300+ PHP versions simultaneously
<?php $number_of_tests = 40000; $time_array = array(); $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; preg_replace('/\\?.*/', '', $str); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Regexp'; echo "regexp execution time: ".$totaltime." seconds; "; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $str = explode('?', $str); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Explode'; echo "explode execution time: ".$totaltime." seconds; "; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $qPos = strpos($str, "?"); $url_without_query_string = substr($str, 0, $qPos); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Substr'; echo "strpos execution time: ".$totaltime." seconds; "; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $url_without_query_string = strtok($str, '?'); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Strtok'; echo "tok execution time: ".$totaltime." seconds; "; echo "<pre>"; print_r($time_array);

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.0060.04515.22
7.3.120.0060.04115.26
7.3.110.0080.04514.79
7.3.100.0080.03615.03
7.3.90.0060.02914.91
7.3.80.0050.03714.88
7.3.70.0060.02915.02
7.3.60.0030.03515.05
7.3.50.0070.04114.92
7.3.40.0070.03315.09
7.3.30.0020.03714.81
7.3.20.0050.03616.79
7.3.10.0080.03016.79
7.3.00.0090.02916.77
7.2.250.0130.03115.46
7.2.240.0070.04515.35
7.2.230.0070.03915.12
7.2.220.0020.03915.11
7.2.210.0030.04215.32
7.2.200.0050.03715.46
7.2.190.0030.03915.24
7.2.180.0050.03515.18
7.2.170.0070.03115.24
7.2.160.0110.03215.48
7.2.150.0100.02917.20
7.2.140.0070.03116.79
7.2.130.0070.02917.04
7.2.120.0100.03116.82
7.2.110.0070.04017.11
7.2.100.0060.03216.75
7.2.90.0030.05117.11
7.2.80.0000.04917.20
7.2.70.0000.03516.90
7.2.60.0070.03717.12
7.2.50.0030.03117.08
7.2.40.0030.03517.11
7.2.30.0040.03516.95
7.2.20.0100.03017.14
7.2.10.0070.03016.89
7.2.00.0060.03718.40
7.1.330.0070.05315.86
7.1.320.0070.04615.96
7.1.310.0050.04616.08
7.1.300.0100.04415.68
7.1.290.0100.05016.00
7.1.280.0030.04215.86
7.1.270.0020.04815.82
7.1.260.0050.04816.09
7.1.250.0070.05215.98
7.1.240.0070.04616.16
7.1.230.0030.05316.04
7.1.220.0070.04315.79
7.1.210.0060.04115.87
7.1.200.0100.04315.93
7.1.190.0030.04615.84
7.1.180.0070.04415.88
7.1.170.0000.05215.89
7.1.160.0090.03815.93
7.1.150.0030.05015.99
7.1.140.0070.04315.86
7.1.130.0100.03815.61
7.1.120.0060.04415.82
7.1.110.0070.05715.96
7.1.100.0070.04215.97
7.1.90.0070.06216.05
7.1.80.0070.04515.80
7.1.70.0050.03516.67
7.1.60.0050.05217.79
7.1.50.0070.04816.49
7.1.40.0000.04915.96
7.1.30.0070.04315.89
7.1.20.0060.04716.11
7.1.10.0100.03616.00
7.1.00.0000.08219.26
7.0.330.0100.04315.29
7.0.320.0070.04315.38
7.0.310.0000.04515.41
7.0.300.0060.04215.18
7.0.290.0070.04715.65
7.0.280.0000.04815.46
7.0.270.0030.04615.68
7.0.260.0030.05015.57
7.0.250.0100.04215.32
7.0.240.0030.04715.71
7.0.230.0130.05315.64
7.0.220.0100.04015.43
7.0.210.0030.05015.44
7.0.200.0020.04316.26
7.0.190.0100.04215.64
7.0.180.0030.04715.56
7.0.170.0030.05015.69
7.0.160.0000.05015.60
7.0.150.0030.04615.25
7.0.140.0030.07618.71
7.0.130.0070.04915.30
7.0.120.0000.07115.56
7.0.110.0070.04415.64
7.0.100.0030.04615.55
7.0.90.0030.05015.36
7.0.80.0030.04815.64
7.0.70.0070.03815.21
7.0.60.0130.07517.91
7.0.50.0060.05416.76
7.0.40.0080.08516.64
7.0.30.0100.06816.78
7.0.20.0200.06016.87
7.0.10.0170.07616.79
7.0.00.0100.07116.78
5.6.400.0030.09814.52
5.6.390.0070.09314.46
5.6.380.0100.09714.34
5.6.370.0070.09914.48
5.6.360.0100.10514.11
5.6.350.0100.10414.81
5.6.340.0030.10214.68
5.6.330.0000.12114.62
5.6.320.0070.09514.50
5.6.310.0030.10514.59
5.6.300.0000.13914.45
5.6.290.0070.10914.62
5.6.280.0050.14117.79
5.6.270.0000.11614.29
5.6.260.0070.10014.65
5.6.250.0070.10914.66
5.6.240.0070.09214.62
5.6.230.0030.10314.16
5.6.220.0070.09914.77
5.6.210.0060.10517.71
5.6.200.0050.10116.35
5.6.190.0070.11017.56
5.6.180.0080.11517.33
5.6.170.0200.12017.57
5.6.160.0050.10717.46
5.6.150.0030.09816.21
5.6.140.0020.12916.39
5.6.130.0000.10316.31
5.6.120.0080.11617.59
5.6.110.0070.10217.76
5.6.100.0120.12217.84
5.6.90.0030.10217.66
5.6.80.0070.11117.42
5.6.70.0200.12517.50
5.6.60.0000.11114.59
5.6.50.0030.11514.42
5.6.40.0000.10314.34
5.6.30.0070.09714.34
5.6.20.0100.10714.30
5.6.10.0000.13514.57
5.6.00.0030.10214.15
5.5.380.0030.09614.38
5.5.370.0000.11214.63
5.5.360.0030.10514.41
5.5.350.0030.11117.48
5.5.340.0050.13016.18
5.5.330.0030.10717.27
5.5.320.0120.11517.24
5.5.310.0200.12117.23
5.5.300.0100.09916.19
5.5.290.0080.11616.34
5.5.280.0080.13017.47
5.5.270.0050.13517.75
5.5.260.0050.12417.74
5.5.250.0100.13017.71
5.5.240.0020.11717.17
5.5.230.0030.10314.21
5.5.220.0100.09614.35
5.5.210.0030.10114.09
5.5.200.0030.11614.20
5.5.190.0030.10614.52
5.5.180.0070.10314.55
5.5.170.0000.11214.02
5.5.160.0030.09814.15
5.5.150.0070.10113.88
5.5.140.0100.09714.27
5.5.130.0100.10714.38
5.5.120.0070.10014.35
5.5.110.0030.10014.00
5.5.100.0070.09814.32
5.5.90.0030.09914.32
5.5.80.0070.11114.24
5.5.70.0000.10814.54
5.5.60.0000.11514.23
5.5.50.0070.10314.50
5.5.40.0030.12314.50
5.5.30.0030.12014.28
5.5.20.0100.10514.45
5.5.10.0000.10314.35
5.5.00.0030.13014.17
5.4.450.0100.11315.32
5.4.440.0280.11815.45
5.4.430.0020.12315.44
5.4.420.0130.11515.45
5.4.410.0130.14815.48
5.4.400.1370.04514.80
5.4.390.1300.04914.94
5.4.380.0120.13714.90
5.4.370.0250.11814.76
5.4.360.0150.11314.87
5.4.350.0130.11514.96
5.4.340.0180.11614.86
5.4.330.0070.12611.29
5.4.320.0040.10111.93
5.4.310.0060.10011.85
5.4.300.0040.09911.75
5.4.290.0060.10811.81
5.4.280.0050.09711.69
5.4.270.0040.10311.82
5.4.260.0070.13914.96
5.4.250.0020.12115.11
5.4.240.0070.16615.08
5.4.230.0050.12314.93
5.4.220.0050.11914.86
5.4.210.0030.13915.06
5.4.200.0100.12715.03
5.4.190.0070.11114.99
5.4.180.0070.13215.04
5.4.170.0070.12514.92
5.4.160.0050.12414.91
5.4.150.0050.16214.93
5.4.140.0050.13513.80
5.4.130.0070.12813.67
5.4.120.0100.15113.67
5.4.110.0120.11313.74
5.4.100.0120.15413.68
5.4.90.0050.15713.62
5.4.80.0030.12313.82
5.4.70.0100.12913.70
5.4.60.0080.14313.78
5.4.50.0050.11313.73
5.4.40.0120.15813.68
5.4.30.0120.12313.77
5.4.20.0030.12013.77
5.4.10.0050.12513.50
5.4.00.0070.15013.29
5.3.290.0050.11611.76
5.3.280.0070.17012.50
5.3.270.0070.16212.60
5.3.260.0130.17412.66
5.3.250.0000.13612.70
5.3.240.0080.13612.54
5.3.230.0050.13512.56
5.3.220.0050.17412.52
5.3.210.0100.16212.48
5.3.200.0080.15012.61
5.3.190.0080.16112.65
5.3.180.0100.13912.50
5.3.170.0130.13612.72
5.3.160.0050.16012.59
5.3.150.0020.14212.52
5.3.140.0070.14412.64
5.3.130.0050.17612.60
5.3.120.0070.14312.59
5.3.110.0000.14412.57
5.3.100.0070.18112.12
5.3.90.0080.14612.23
5.3.80.0080.16912.25
5.3.70.0030.14712.13
5.3.60.0030.14512.21
5.3.50.0080.13812.29
5.3.40.0080.18312.22
5.3.30.0070.17912.14
5.3.20.0030.16812.08
5.3.10.0070.18311.94
5.3.00.0100.17311.96
5.2.170.0130.13711.01
5.2.160.0070.18711.09
5.2.150.0100.17311.01
5.2.140.0100.17311.26
5.2.130.0130.16011.13
5.2.120.0100.16311.25
5.2.110.0100.14711.14
5.2.100.0070.16011.16
5.2.90.0030.19011.04
5.2.80.0070.20011.11
5.2.70.0130.21310.88
5.2.60.0270.20710.96
5.2.50.0100.21710.96
5.2.40.0100.21011.05
5.2.30.0030.22711.11
5.2.20.0030.14311.01
5.2.10.0200.12010.78
5.2.00.0030.22710.89
5.1.60.0030.13710.14
5.1.50.0000.12310.11
5.1.40.0130.14010.09
5.1.30.0070.17310.48
5.1.20.0130.18310.43
5.1.10.0030.13310.08
5.1.00.0030.11710.08
5.0.50.0000.1908.78
5.0.40.0030.2108.56
5.0.30.0070.2078.27
5.0.20.0030.1738.14
5.0.10.0070.2408.04
5.0.00.0000.2178.27
4.4.90.0100.2607.46
4.4.80.0030.1977.46
4.4.70.0070.2007.46
4.4.60.0070.1977.46
4.4.50.0030.2377.46
4.4.40.0030.2137.46
4.4.30.0030.1907.46
4.4.20.0070.3177.46
4.4.10.0070.2337.46
4.4.00.0070.2107.46
4.3.110.0070.1977.46
4.3.100.0100.2637.46
4.3.90.0030.1877.46
4.3.80.0070.2137.46
4.3.70.0100.2707.46
4.3.60.0030.2007.46
4.3.50.0170.2037.46
4.3.40.0030.2237.46
4.3.30.0000.2107.46
4.3.20.0030.2377.46
4.3.10.0070.2537.46
4.3.00.0130.1579.26

preferences:
40.09 ms | 400 KiB | 5 Q