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'; $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'; $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'; $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 "<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.3.10.0070.03916.77
7.3.00.0120.03716.46
7.2.130.0060.04217.04
7.2.120.0130.03016.88
7.2.110.0130.03217.01
7.2.100.0090.04516.88
7.2.90.0090.04417.01
7.2.80.0100.04616.85
7.2.70.0130.03617.09
7.2.60.0000.04516.79
7.2.50.0100.03016.93
7.2.40.0000.04417.02
7.2.30.0070.04117.07
7.2.20.0070.04016.86
7.2.10.0000.04517.22
7.2.00.0100.02918.36
7.1.250.0070.04715.66
7.1.70.0000.02717.38
7.1.60.0100.05119.82
7.1.50.0110.02117.21
7.1.00.0100.09722.31
7.0.200.0030.03616.95
7.0.140.0070.09722.12
7.0.60.0000.08319.89
7.0.50.0100.05717.94
7.0.40.0130.10020.26
7.0.30.0200.06020.15
7.0.20.0200.11020.14
7.0.10.0030.06720.23
7.0.00.0000.11320.11
5.6.280.0070.15021.13
5.6.210.0170.12720.52
5.6.200.0070.15018.13
5.6.190.0170.13320.43
5.6.180.0470.12020.37
5.6.170.0200.10320.48
5.6.160.0070.09020.38
5.6.150.0030.14318.18
5.6.140.0470.09018.18
5.6.130.0070.13018.21
5.6.120.0070.10021.00
5.6.110.0200.14021.03
5.6.100.0130.14321.02
5.6.90.0030.10720.98
5.6.80.0130.15320.40
5.5.350.0170.13320.54
5.5.340.0100.15017.98
5.5.330.0070.11020.13
5.5.320.0030.12020.34
5.5.310.0230.14720.34
5.5.300.0100.15017.88
5.5.290.0070.14017.92
5.5.280.0000.14720.95
5.5.270.0100.11020.70
5.5.260.0070.14020.78
5.5.250.0100.15720.48
5.5.240.0070.16320.27
5.4.450.0300.14019.21
5.4.440.0400.08719.41
5.4.430.0130.13319.48
5.4.420.0170.13319.33
5.4.410.0070.14719.31
5.4.400.2270.00018.77
5.4.390.2330.00018.54
5.4.380.0270.18018.51
5.4.370.0430.13318.51
5.4.360.0200.13018.70
5.4.350.0330.13318.51
5.4.340.0400.11718.68
5.4.320.0070.09312.48
5.4.310.0070.09812.48
5.4.300.0060.09712.48
5.4.290.0060.09512.48
5.4.280.0040.11612.37
5.4.270.0090.10512.37
5.4.260.0070.16018.73
5.4.250.0130.21318.98
5.4.240.0130.13719.04
5.4.230.0230.14018.83
5.4.220.0100.18718.83
5.4.210.0100.19018.64
5.4.200.0030.14318.93
5.4.190.0100.18318.76
5.4.180.0130.21018.69
5.4.170.0130.17319.01
5.4.160.0070.13718.97
5.4.150.0100.20718.86
5.4.140.0130.15016.27
5.4.130.0100.14016.29
5.4.120.0000.16716.46
5.4.110.0100.12716.48
5.4.100.0000.15316.49
5.4.90.0030.13316.41
5.4.80.0070.16716.38
5.4.70.0070.12716.48
5.4.60.0100.12716.19
5.4.50.0070.20016.18
5.4.40.0030.21016.37
5.4.30.0100.20016.41
5.4.20.0070.16316.41
5.4.10.0130.13316.31
5.4.00.0130.20715.95
5.3.290.0080.10912.80
5.3.280.0130.21014.46
5.3.270.0070.15314.67
5.3.260.0130.15014.64
5.3.250.0130.18714.63
5.3.240.0070.20714.63
5.3.230.0170.14314.66
5.3.220.0230.17014.59
5.3.210.0170.24314.59
5.3.200.0070.19714.43
5.3.190.0200.24014.60
5.3.180.0130.20714.29
5.3.170.0100.16714.42
5.3.160.0030.15014.50
5.3.150.0030.17714.47
5.3.140.0170.14014.28
5.3.130.0130.21314.57
5.3.120.0130.15314.61
5.3.110.0000.15314.40
5.3.100.0100.20714.21
5.3.90.0170.13714.05
5.3.80.0000.15714.05
5.3.70.0030.14314.13

preferences:
32.84 ms | 400 KiB | 5 Q