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 = 14000) { $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.0100.00715.46
7.3.120.0100.12015.96
7.3.110.0070.15216.09
7.3.100.0000.12616.01
7.3.90.0070.11615.83
7.3.80.0030.12215.60
7.3.70.0070.15315.99
7.3.60.0030.12915.63
7.3.50.0070.12615.95
7.3.40.0070.12915.73
7.3.30.0070.15515.88
7.3.20.0030.15817.52
7.3.10.0030.12817.60
7.3.00.0070.10917.46
7.2.250.0100.13315.89
7.2.240.0100.13316.27
7.2.230.0030.14716.30
7.2.220.0100.12716.07
7.2.210.0070.14916.12
7.2.200.0030.14216.33
7.2.190.0070.12715.87
7.2.180.0030.12416.05
7.2.170.0030.14415.96
7.2.00.0100.11520.41
7.1.330.0070.20416.69
7.1.320.0030.22717.04
7.1.310.0030.22516.72
7.1.300.0130.20117.01
7.1.290.0030.21716.71
7.1.280.0100.20616.45
7.1.270.0000.21916.64
7.1.260.0030.21816.73
7.1.70.0030.11218.25
7.1.60.0100.15419.40
7.1.50.0030.10718.07
7.1.00.0070.22023.07
7.0.200.0680.10215.96
7.0.140.0070.22722.57
7.0.120.0030.19722.71
7.0.100.0030.21320.71
7.0.90.0030.18720.70
7.0.80.0300.23320.67
7.0.70.0200.20720.64
7.0.60.0200.13020.70
7.0.50.0000.14721.07
7.0.40.0070.12020.75
7.0.30.0070.12320.67
7.0.20.0030.12020.67
7.0.10.0030.11720.73
7.0.00.0100.11020.62
5.6.280.0070.39722.14
5.6.250.0130.33021.70
5.6.240.0070.36721.58
5.6.230.0130.31321.50
5.6.220.0130.40021.46
5.6.210.0030.37721.43
5.6.200.0030.32322.20
5.6.190.0030.27022.28
5.6.180.0030.28322.19
5.6.170.0070.26722.20
5.6.160.0100.32022.22
5.6.150.0070.26322.29
5.6.140.0100.26722.14
5.6.130.0130.36722.08
5.6.120.0070.31022.26
5.6.110.0130.30722.21
5.6.100.0030.32722.09
5.6.90.0100.32722.21
5.6.80.0500.28021.59
5.6.70.0130.39321.61
5.6.60.0070.32321.55
5.6.50.0030.32321.64
5.6.40.0100.41321.55
5.6.30.0070.39321.46
5.6.20.0070.34721.52
5.6.10.0030.37321.49
5.6.00.0100.34321.59
5.5.380.0130.36321.25
5.5.370.0100.33021.25
5.5.360.0030.30721.34
5.5.350.0070.31721.58
5.5.340.0070.31321.99
5.5.330.0030.28322.05
5.5.320.0070.26722.06
5.5.310.0100.26321.91
5.5.300.0070.27321.96
5.5.290.0130.33021.93
5.5.280.0530.29321.96
5.5.270.0070.39322.04
5.5.260.0000.40321.91
5.5.250.0130.36721.76
5.5.240.0100.42021.30
5.5.230.0030.33721.35
5.5.220.0030.32321.31
5.5.210.0030.39021.35
5.5.200.0030.40321.35
5.5.190.0100.38321.16
5.5.180.0030.34021.32
5.5.160.0130.34021.33
5.5.150.0030.32321.14
5.5.140.0100.38321.21
5.5.130.0030.38021.41
5.5.120.0030.31021.31
5.5.110.0000.34021.36
5.5.100.0030.33021.20
5.5.90.0070.31721.34
5.5.80.0000.33021.16
5.5.70.0070.38021.25
5.5.60.0130.36021.23
5.5.50.0170.37321.25
5.5.40.0130.33721.18
5.5.30.0030.38321.10
5.5.20.0070.32021.18
5.5.10.0000.32321.18
5.5.00.0500.27321.24
5.4.450.0070.32320.35
5.4.440.0070.31020.13
5.4.430.0100.38020.30
5.4.420.0070.32320.14
5.4.410.0030.29019.99
5.4.400.0000.31320.02
5.4.390.0000.36319.85
5.4.380.0030.39319.76
5.4.370.0000.33719.85
5.4.360.0100.39320.04
5.4.350.0200.36720.00
5.4.340.0100.36719.77
5.4.320.0170.36019.88
5.4.310.0100.38019.83
5.4.300.0030.30720.05
5.4.290.0100.38019.87
5.4.280.0000.39020.00
5.4.270.0000.34720.00
5.4.260.0130.35319.96
5.4.250.0030.38719.88
5.4.240.0070.38319.79
5.4.230.0070.31319.99
5.4.220.0030.35319.84
5.4.210.0130.35719.89
5.4.200.0070.31019.85
5.4.190.0070.32019.77
5.4.180.0030.32319.79
5.4.170.0130.36319.89
5.4.160.0070.36319.88
5.4.150.0030.26319.86
5.4.140.0100.33717.16
5.4.130.0000.28717.23
5.4.120.0000.37717.15
5.4.110.0030.34017.34
5.4.100.0100.33717.23
5.4.90.0130.36717.41
5.4.80.0070.30717.18
5.4.70.0030.36017.34
5.4.60.0030.37017.38
5.4.50.0070.33017.18
5.4.40.0000.34717.31
5.4.30.0100.31017.34
5.4.20.0170.34017.07
5.4.10.0130.39317.32
5.4.00.0070.36716.58
5.3.290.0000.37015.75
5.3.280.0030.40315.69
5.3.270.0100.42315.70
5.3.260.0130.42315.70
5.3.250.0070.38715.65
5.3.240.0030.44315.70
5.3.230.0100.42015.77
5.3.220.0070.36015.52
5.3.210.0030.41315.61
5.3.200.0100.43015.64
5.3.190.0130.42715.69
5.3.180.0000.43015.59
5.3.170.0100.36315.66
5.3.160.0030.42715.73
5.3.150.0100.43715.66
5.3.140.0100.41015.66
5.3.130.0030.39715.62
5.3.120.0170.42715.67
5.3.110.0000.40715.58
5.3.100.0030.42715.10
5.3.90.0030.40315.12
5.3.80.0000.44715.05
5.3.70.0030.37315.11
5.3.60.0100.40315.09
5.3.50.0000.39714.97
5.3.40.0030.43314.93
5.3.30.0070.37715.08
5.3.20.0070.31314.73
5.3.10.0030.33014.75
5.3.00.0000.32014.66
5.2.170.0100.55712.09
5.2.160.0500.41312.04
5.2.150.0000.46711.99
5.2.140.0030.43012.04
5.2.130.0030.45011.99
5.2.120.0030.39311.95
5.2.110.0000.39711.95
5.2.100.0030.44012.05
5.2.90.0030.38711.95
5.2.80.1070.39712.06
5.2.70.0030.39012.09
5.2.60.0030.38011.95
5.2.50.0070.50712.02
5.2.40.0070.54311.89
5.2.30.0000.40311.96
5.2.20.0070.59311.96
5.2.10.0030.52311.68
5.2.00.0030.54711.52
5.1.60.0030.50311.38
5.1.50.0000.47311.38
5.1.40.0070.54711.38
5.1.30.0070.56011.38
5.1.20.0070.53011.38
5.1.10.0000.58311.38
5.1.00.0000.54311.38
5.0.50.0030.97711.38
5.0.40.0001.03311.38
5.0.30.0070.85711.38
5.0.20.0000.98011.38
5.0.10.0030.87711.38
5.0.00.0071.01311.38
4.4.90.0030.93311.38
4.4.80.0000.75011.38
4.4.70.0030.77311.38
4.4.60.0000.84711.38
4.4.50.0030.92711.38
4.4.40.0030.90311.38
4.4.30.0030.92011.38
4.4.20.0030.97311.38
4.4.10.0000.94311.38
4.4.00.0000.97011.38
4.3.110.0000.84311.38
4.3.100.0000.88011.38
4.3.90.0530.95711.38
4.3.80.0100.98711.38
4.3.70.0000.99711.38
4.3.60.1230.84711.38
4.3.50.0000.98711.38
4.3.40.0100.86311.38
4.3.30.0030.98711.38
4.3.20.0000.80311.38
4.3.10.0030.96711.38
4.3.00.0030.89011.38

preferences:
38.59 ms | 401 KiB | 5 Q