3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_SERVER['SERVER_NAME'] = 'localhost'; $_SERVER['SERVER_ADDR'] = '127.0.0.1'; function test_Math($count = 1400) { $time_start = microtime(true); $mathFunctions = array("abs", "acos", "asin", "atan", "bindec", "floor", "exp", "sin", "tan", "pi", "is_finite", "is_nan", "sqrt"); foreach ($mathFunctions as $key => $function) { if (!function_exists($function)) unset($mathFunctions[$key]); } for ($i=0; $i < $count; $i++) { foreach ($mathFunctions as $function) { $r = call_user_func_array($function, array($i)); } } return number_format(microtime(true) - $time_start, 3); } function test_StringManipulation($count = 13000) { $time_start = microtime(true); $stringFunctions = array("addslashes", "chunk_split", "metaphone", "strip_tags", "md5", "sha1", "strtoupper", "strtolower", "strrev", "strlen", "soundex", "ord"); foreach ($stringFunctions as $key => $function) { if (!function_exists($function)) unset($stringFunctions[$key]); } $string = "the quick brown fox jumps over the lazy dog"; for ($i=0; $i < $count; $i++) { foreach ($stringFunctions as $function) { $r = call_user_func_array($function, array($string)); } } return number_format(microtime(true) - $time_start, 3); } function test_Loops($count = 1900000) { $time_start = microtime(true); for($i = 0; $i < $count; ++$i); $i = 0; while($i < $count) ++$i; return number_format(microtime(true) - $time_start, 3); } function test_IfElse($count = 900000) { $time_start = microtime(true); for ($i=0; $i < $count; $i++) { if ($i == -1) { } elseif ($i == -2) { } else if ($i == -3) { } } return number_format(microtime(true) - $time_start, 3); } $total = 0; $functions = get_defined_functions(); $line = str_pad("-",38,"-"); echo "<pre>$line\n|".str_pad("PHP BENCHMARK SCRIPT",36," ",STR_PAD_BOTH)."|\n$line\nStart : ".date("Y-m-d H:i:s")."\nServer : {$_SERVER['SERVER_NAME']}@{$_SERVER['SERVER_ADDR']}\nPHP version : ".PHP_VERSION."\nPlatform : ".PHP_OS. "\n$line\n"; foreach ($functions['user'] as $user) { if (preg_match('/^test_/', $user)) { $total += $result = $user(); echo str_pad($user, 25) . " : " . $result ." sec.\n"; } } echo str_pad("-", 38, "-") . "\n" . str_pad("Total time:", 25) . " : " . $total ." sec.</pre>";

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.01015.86
7.3.120.0070.10516.04
7.3.110.0070.10015.77
7.3.100.0070.09515.92
7.3.90.0030.09515.77
7.3.80.0100.09915.61
7.3.70.0060.09415.96
7.3.60.0030.09715.97
7.3.50.0030.09615.91
7.3.40.0030.13116.01
7.3.30.0030.10715.94
7.3.20.0070.09217.51
7.3.10.0030.09517.58
7.3.00.0070.09517.48
7.2.250.0070.10815.93
7.2.240.0160.09916.33
7.2.230.0100.12216.17
7.2.220.0030.11016.02
7.2.210.0070.10415.85
7.2.200.0000.10416.00
7.2.190.0070.09716.09
7.2.180.0030.10616.07
7.2.170.0100.11915.84
7.2.00.0100.07520.55
7.1.330.0100.18016.62
7.1.320.0070.16516.98
7.1.310.0070.17016.74
7.1.300.0130.17416.52
7.1.290.0030.17516.58
7.1.280.0030.17616.71
7.1.270.0030.17016.95
7.1.260.0030.17216.67
7.1.70.0000.08717.91
7.1.60.0200.11619.82
7.1.50.0070.13018.00
7.1.00.0000.20022.96
7.0.200.0030.12017.62
7.0.140.0030.20322.64
7.0.80.0500.15720.52
7.0.70.0400.11020.58
7.0.60.0300.10020.57
7.0.50.0370.11320.95
7.0.40.0070.11320.63
7.0.30.0100.11320.71
7.0.20.0170.15320.68
7.0.10.0070.17020.57
7.0.00.0030.11720.67
5.6.280.0030.33021.69
5.6.230.0030.26021.43
5.6.220.0070.21021.45
5.6.210.0030.23721.45
5.6.200.0100.19322.08
5.6.190.0070.28022.17
5.6.180.0030.23722.11
5.6.170.0100.21322.16
5.6.160.0030.25022.14
5.6.150.0000.24022.10
5.6.140.0130.28022.07
5.6.130.0030.24322.07
5.6.120.0070.29022.04
5.6.110.0100.30322.07
5.6.100.0070.30722.09
5.6.90.0030.25722.15
5.6.80.0230.32021.52
5.6.70.0170.29321.54
5.6.60.0070.23721.55
5.6.50.0130.27721.55
5.6.40.0030.26021.55
5.6.30.0070.30021.53
5.6.20.0000.30021.48
5.6.10.0030.28021.43
5.6.00.0000.24321.42
5.5.370.0070.30721.52
5.5.360.0030.23021.16
5.5.350.0070.26721.25
5.5.340.0030.22321.94
5.5.330.0100.24321.87
5.5.320.0100.23321.95
5.5.310.0100.30021.80
5.5.300.0100.28721.92
5.5.290.0000.25021.86
5.5.280.0030.31721.91
5.5.270.0070.29021.94
5.5.260.0030.31021.90
5.5.250.0130.30321.51
5.5.240.0170.27721.09
5.5.230.0130.30021.25
5.5.220.0070.28321.05
5.5.210.0030.23721.08
5.5.200.0070.24721.23
5.5.190.0100.28721.20
5.5.180.0070.23721.27
5.5.160.0030.28721.32
5.5.150.0030.30321.21
5.5.140.0200.29021.05
5.5.130.0070.28321.29
5.5.120.0030.25321.26
5.5.110.0030.29321.22
5.5.100.0070.29321.19
5.5.90.0070.28021.18
5.5.80.0030.24021.14
5.5.70.0200.26721.19
5.5.60.0000.31021.20
5.5.50.0130.28721.10
5.5.40.0100.31721.08
5.5.30.0130.29321.01
5.5.20.0000.25721.17
5.5.10.0100.25321.18
5.5.00.0100.31321.05
5.4.450.0170.29020.07
5.4.440.0000.29720.06
5.4.430.0070.24020.17
5.4.420.0070.31020.08
5.4.410.0000.29320.19
5.4.400.0030.29019.97
5.4.390.0070.30319.99
5.4.380.0000.28319.78
5.4.370.0100.26719.82
5.4.360.0130.28719.82
5.4.350.0070.29319.80
5.4.340.0100.28719.82
5.4.320.0100.26019.73
5.4.310.0170.22019.84
5.4.300.0030.24019.70
5.4.290.0000.29319.73
5.4.280.0200.27719.83
5.4.270.0070.24719.75
5.4.260.0100.27319.95
5.4.250.0130.27019.94
5.4.240.0030.26019.83
5.4.230.0170.22319.87
5.4.220.0070.30019.79
5.4.210.0100.28319.71
5.4.200.0000.30319.93
5.4.190.0030.28719.95
5.4.180.0030.23719.77
5.4.170.0030.26319.79
5.4.160.0030.30319.70
5.4.150.0070.30319.77
5.4.140.0030.31317.20
5.4.130.0100.31017.04
5.4.120.0100.27717.11
5.4.110.0070.31717.19
5.4.100.0100.26017.29
5.4.90.0100.26717.29
5.4.80.0100.28017.20
5.4.70.0030.21317.30
5.4.60.0030.19317.29
5.4.50.0070.21017.06
5.4.40.0030.28717.30
5.4.30.0130.29317.15
5.4.20.0130.33017.25
5.4.10.0130.28017.23
5.4.00.0600.25716.71
5.3.290.0070.33715.73
5.3.280.0230.33015.60
5.3.270.0100.27315.58
5.3.260.0070.37015.65
5.3.250.0000.30015.61
5.3.240.0070.36015.61
5.3.230.0070.34015.54
5.3.220.0000.31715.66
5.3.210.0000.31715.64
5.3.200.0030.32315.57
5.3.190.0000.28015.60
5.3.180.0130.35715.59
5.3.170.0000.28715.64
5.3.160.0130.30015.52
5.3.150.0070.26315.59
5.3.140.0000.34315.58
5.3.130.0000.30715.59
5.3.120.0030.29015.57
5.3.110.0070.29315.64
5.3.100.0100.32015.11
5.3.90.0070.29315.06
5.3.80.0170.34714.97
5.3.70.0030.29315.04
5.3.60.0100.30014.93
5.3.50.0030.31014.90
5.3.40.0130.33715.05
5.3.30.0070.29314.88
5.3.20.0070.31014.80
5.3.10.0070.32314.61
5.3.00.0070.35014.59
5.2.170.0030.40712.06
5.2.160.0030.40311.93
5.2.150.0030.44711.98
5.2.140.0100.44011.97
5.2.130.0030.40712.04
5.2.120.0070.41311.92
5.2.110.0000.37711.92
5.2.100.0070.42311.93
5.2.90.0030.41011.85
5.2.80.0070.44312.02
5.2.70.0030.42711.87
5.2.60.0030.42311.88
5.2.50.0070.37011.96
5.2.40.0000.37011.83
5.2.30.0030.40711.88
5.2.20.0030.47011.79
5.2.10.0030.33011.63
5.2.00.0000.35311.61
5.1.60.0030.46710.94
5.1.50.0000.42710.91
5.1.40.0000.47310.79
5.1.30.0030.46011.10
5.1.20.0030.47711.17
5.1.10.0100.46711.24
5.1.00.0000.42010.76
5.0.50.0000.9039.38
5.0.40.0030.8979.25
5.0.30.0070.8809.10
5.0.20.0000.7909.01
5.0.10.0070.8339.12
5.0.00.0100.8708.94
4.4.90.0000.8436.70
4.4.80.0000.7936.70
4.4.70.0000.7006.71
4.4.60.0030.6776.71
4.4.50.0000.7336.71
4.4.40.0030.8536.71
4.4.30.0030.8236.71
4.4.20.0070.8406.71
4.4.10.0000.8236.71
4.4.00.0070.8706.71
4.3.110.0030.8136.71
4.3.100.0000.8236.71
4.3.90.0000.6776.71
4.3.80.0000.8636.71
4.3.70.0030.8236.71
4.3.60.0030.7406.71
4.3.50.0000.7406.71
4.3.40.0030.9006.71
4.3.30.0030.7476.71
4.3.20.0000.8636.71
4.3.10.0030.8936.71
4.3.00.0000.7636.71

preferences:
66.64 ms | 401 KiB | 5 Q