3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_Math($count = 140000) { $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 = 130000) { $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 = 19000000) { $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 = 9000000) { $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"; } }

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.0061.22417.73
7.3.00.0091.19117.74
7.2.130.0071.31217.99
7.2.120.0081.26317.88
7.2.110.0081.33017.75
7.2.100.0061.30517.90
7.2.90.0091.29417.96
7.2.80.0021.30817.89
7.2.70.0131.27517.99
7.2.60.0101.31817.94
7.2.50.0071.33518.04
7.2.40.0081.28717.79
7.2.30.0081.33917.78
7.2.20.0091.30917.77
7.2.10.0091.28918.00
7.2.00.0121.25517.86
7.1.250.0112.07116.76
7.1.70.0731.03418.18
7.1.60.0130.96019.82
7.1.50.0130.95018.09
7.1.00.0031.14322.98
7.0.200.2171.01917.55
7.0.140.0001.22322.77
7.0.100.0030.81722.37
7.0.90.0100.91322.33
7.0.80.0100.95020.62
7.0.70.0000.82320.57
7.0.60.0130.91320.56
7.0.50.0131.10021.01
7.0.40.0101.13020.67
7.0.30.0070.89720.63
7.0.20.0071.04720.68
7.0.10.0100.89320.75
7.0.00.0031.12020.78
5.6.280.0072.49322.22
5.6.250.0032.37321.44
5.6.240.0032.49721.65
5.6.230.0032.49721.62
5.6.220.0072.34721.48
5.6.210.0132.48721.75
5.6.200.0132.48722.14
5.6.190.0132.48722.17
5.6.180.0202.48022.19
5.6.170.0102.47022.17
5.6.160.0002.50022.19
5.6.150.0032.48722.14
5.6.140.0032.49722.22
5.6.130.0102.49022.20
5.6.120.0032.49722.21
5.6.110.0232.39722.09
5.6.100.0172.48322.09
5.6.90.0132.48722.24
5.6.80.0102.43321.53
5.6.70.0002.50021.53
5.6.60.0102.47321.57
5.6.50.0072.31021.61
5.6.40.0002.50021.50
5.6.30.0102.43021.61
5.6.20.0132.48721.55
5.6.10.0072.49321.58
5.6.00.0032.46021.57
5.5.380.0072.49321.48
5.5.370.0032.49721.51
5.5.360.0202.35021.30
5.5.350.0102.49021.52
5.5.340.0102.49021.93
5.5.330.0072.49321.98
5.5.320.0202.43321.66
5.5.310.0032.49722.05
5.5.300.0032.49721.98
5.5.290.0002.48722.02
5.5.280.0102.49022.05
5.5.270.0002.50022.05
5.5.260.0202.40721.94
5.5.250.0102.49021.75
5.5.240.0072.49321.33
5.5.230.0272.41721.19
5.5.220.0102.49021.38
5.5.210.0032.40021.26
5.5.200.0232.40321.18
5.5.190.0302.37721.11
5.5.180.0072.49321.15
5.5.160.0372.38021.02
5.5.150.0102.49021.42
5.5.140.0102.36021.32
5.5.130.0172.42021.38
5.5.120.0032.37721.37
5.5.110.0032.38321.18
5.5.100.0072.49321.13
5.5.90.0002.42021.33
5.5.80.0132.48721.26
5.5.70.0132.45020.96
5.5.60.0102.41721.00
5.5.50.0132.48721.25
5.5.40.0372.40321.07
5.5.30.0072.49321.14
5.5.20.0172.42720.98
5.5.10.0332.43321.05
5.5.00.0032.36721.16
5.4.450.0032.37320.39
5.4.440.0302.35720.07
5.4.430.0102.49020.29
5.4.420.0102.43320.23
5.4.410.0132.48720.24
5.4.400.0072.44719.95
5.4.390.0032.36320.02
5.4.380.0232.32019.80
5.4.370.0132.39719.93
5.4.360.0232.35319.95
5.4.350.0272.43319.97
5.4.340.0332.42019.81
5.4.320.0132.43319.89
5.4.310.0272.43320.08
5.4.300.0102.30319.96
5.4.290.0172.43319.80
5.4.280.0402.41719.91
5.4.270.0002.33719.93
5.4.260.0232.42019.95
5.4.250.0102.49020.04
5.4.240.0032.49719.99
5.4.230.0072.49319.99
5.4.220.0372.41719.88
5.4.210.0072.46020.00
5.4.200.0202.41719.92
5.4.190.0272.40719.70
5.4.180.0072.49320.20
5.4.170.0072.49319.98
5.4.160.0102.41319.80
5.4.150.0032.49720.04
5.4.140.0072.49017.14
5.4.130.0132.34717.14
5.4.120.0302.39017.36
5.4.110.0072.45717.15
5.4.100.0232.39717.40
5.4.90.0102.49017.52
5.4.80.0032.49717.48
5.4.70.0032.49717.51
5.4.60.0102.49017.54
5.4.50.0202.45717.49
5.4.40.0402.41017.35
5.4.30.0102.46317.29
5.4.20.0032.49017.31
5.4.10.0032.49717.47
5.4.00.0402.37316.75
5.3.290.0202.44015.43
5.3.280.0132.42315.45
5.3.270.0402.34715.32
5.3.260.0102.38015.49
5.3.250.0172.48315.50
5.3.240.0272.36315.38
5.3.230.0132.42015.45
5.3.220.0032.49715.54
5.3.210.0072.44315.32
5.3.200.0202.39015.30
5.3.190.0002.50015.58
5.3.180.0072.49315.46
5.3.170.0072.45715.41
5.3.160.0472.36715.32
5.3.150.0132.41715.40
5.3.140.0332.35015.23
5.3.130.0072.49315.55
5.3.120.0072.49315.43
5.3.110.0072.49315.46
5.3.100.0002.50015.04
5.3.90.0132.43314.85
5.3.80.0272.39714.66
5.3.70.0302.42714.67
5.3.60.0032.49714.96
5.3.50.0202.41714.64
5.3.40.0172.44014.63
5.3.30.0072.49314.76
5.3.20.0072.49314.60
5.3.10.0172.39314.33
5.3.00.0232.40014.31

preferences:
36.76 ms | 400 KiB | 5 Q