3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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 = 1300) { $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 = 190000) { $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 = 90000) { $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.2.00.0030.02120.59
7.1.70.0000.01918.29
7.1.60.0100.03319.82
7.1.50.0090.03518.05
7.1.00.0070.09323.14
7.0.200.0030.01317.77
7.0.140.0030.09722.73
7.0.100.0070.10020.61
7.0.90.0270.07020.77
7.0.80.0300.10320.59
7.0.70.0170.09720.61
7.0.60.0200.09720.48
7.0.50.0130.09320.92
7.0.40.0100.10020.71
7.0.30.0030.09320.61
7.0.20.0130.07020.64
7.0.10.0100.09320.69
7.0.00.0000.09020.57
5.6.280.0030.12021.77
5.6.250.0030.13321.52
5.6.240.0130.11321.61
5.6.230.0030.13021.42
5.6.220.0070.13321.50
5.6.210.0030.13021.51
5.6.200.0170.11021.86
5.6.190.0230.11721.87
5.6.180.0100.06721.87
5.6.170.0030.08721.84
5.6.160.0030.10021.96
5.6.150.0100.11721.86
5.6.140.0130.10721.82
5.6.130.0130.10021.89
5.6.120.0070.12322.01
5.6.110.0100.11721.88
5.6.100.0170.10721.84
5.6.90.0030.12021.91
5.6.80.0070.08721.34
5.6.70.0130.10021.29
5.6.60.0170.09721.33
5.6.50.0030.10721.32
5.6.40.0070.09021.34
5.6.30.0070.10021.32
5.6.20.0070.12021.18
5.6.10.0100.12021.29
5.6.00.0170.10021.28
5.5.380.0100.13721.28
5.5.370.0100.11021.23
5.5.360.0130.11321.38
5.5.350.0070.10021.25
5.5.340.0000.14021.56
5.5.330.0100.12321.66
5.5.320.0100.10721.79
5.5.310.0230.11021.73
5.5.300.0070.12021.75
5.5.290.0070.10721.61
5.5.280.0030.07321.64
5.5.270.0100.10721.70
5.5.260.0130.11321.70
5.5.250.0130.09321.52
5.5.240.0100.07021.12
5.5.230.0100.12721.15
5.5.220.0070.10721.02
5.5.210.0130.11721.04
5.5.200.0100.11321.11
5.5.190.0130.10021.00
5.5.180.0100.12321.10
5.5.160.0100.13021.00
5.5.150.0070.10021.05
5.5.140.0100.10721.01
5.5.130.0100.09321.00
5.5.120.0130.09020.96
5.5.110.0100.14021.08
5.5.100.0130.10720.90
5.5.90.0100.09321.01
5.5.80.0100.11021.01
5.5.70.0030.10320.91
5.5.60.0170.08320.84
5.5.50.0030.12320.97
5.5.40.0100.11720.93
5.5.30.0170.09320.92
5.5.20.0070.11320.88
5.5.10.0030.12720.89
5.5.00.0100.11720.93
5.4.450.0170.11320.07
5.4.440.0100.08720.32
5.4.430.0170.10720.05
5.4.420.0000.11320.16
5.4.410.0030.10020.01
5.4.400.0030.10319.93
5.4.390.0130.07019.92
5.4.380.0070.09319.84
5.4.370.0070.11719.99
5.4.360.0030.08319.82
5.4.350.0070.11319.79
5.4.340.0070.11019.74
5.4.320.0070.08719.99
5.4.310.0030.08719.73
5.4.300.0070.12019.84
5.4.290.0070.11719.70
5.4.280.0070.12019.78
5.4.270.0100.10320.02
5.4.260.0070.11019.78
5.4.250.0030.07019.79
5.4.240.0100.11319.73
5.4.230.0070.09319.98
5.4.220.0100.10319.89
5.4.210.0000.07719.86
5.4.200.0070.09319.70
5.4.190.0130.10319.84
5.4.180.0100.11319.95
5.4.170.0070.12319.81
5.4.160.0170.06319.98
5.4.150.0230.07319.68
5.4.140.0100.11017.25
5.4.130.0130.10317.24
5.4.120.0100.10717.23
5.4.110.0070.11717.18
5.4.100.0130.09717.28
5.4.90.0100.11317.31
5.4.80.0070.11017.09
5.4.70.0130.09017.30
5.4.60.0200.12017.12
5.4.50.0100.11317.25
5.4.40.0000.12017.19
5.4.30.0130.11317.04
5.4.20.0100.12017.23
5.4.10.0070.12017.30
5.4.00.0100.11316.68
5.3.290.0030.08015.54
5.3.280.0170.10715.53
5.3.270.0070.11015.51
5.3.260.0070.12015.46
5.3.250.0030.12015.37
5.3.240.0070.13315.40
5.3.230.0200.11315.46
5.3.220.0000.13015.40
5.3.210.0030.13015.36
5.3.200.0130.12715.44
5.3.190.0100.09315.40
5.3.180.0030.13715.45
5.3.170.0170.11715.36
5.3.160.0100.12715.39
5.3.150.0070.11315.38
5.3.140.0170.11715.35
5.3.130.0030.11715.38
5.3.120.0100.11715.33
5.3.110.0130.12315.34
5.3.100.0030.12314.97
5.3.90.0030.12714.91
5.3.80.0130.12714.78
5.3.70.0030.08014.80
5.3.60.0030.12014.79
5.3.50.0030.12014.82
5.3.40.0100.12014.89
5.3.30.0070.12314.82
5.3.20.0030.12714.46
5.3.10.0030.11714.50
5.3.00.0300.10014.49
5.2.170.0170.12711.86
5.2.160.0030.12311.90
5.2.150.0100.13011.98
5.2.140.0070.12711.98
5.2.130.0070.08711.95
5.2.120.0100.12012.02
5.2.110.0170.12311.84
5.2.100.0070.11711.81
5.2.90.0030.12711.86
5.2.80.0070.12311.93
5.2.70.0000.12011.87
5.2.60.0100.12311.79
5.2.50.0170.12311.80
5.2.40.0170.12311.77
5.2.30.0030.13311.86
5.2.20.0070.13011.72
5.2.10.0030.13011.66
5.2.00.0100.09311.51
5.1.60.0100.09311.36
5.1.50.0000.13011.36
5.1.40.0000.10011.36
5.1.30.0030.12311.36
5.1.20.0130.10311.36
5.1.10.0030.12311.36
5.1.00.0170.10711.36
5.0.50.0030.21011.36
5.0.40.0100.18011.36
5.0.30.0000.17311.36
5.0.20.0170.13711.36
5.0.10.0030.16311.36
5.0.00.0030.17711.36
4.4.90.0070.14311.36
4.4.80.0000.15711.36
4.4.70.0030.16011.36
4.4.60.0070.17011.36
4.4.50.0000.14011.36
4.4.40.0000.13711.36
4.4.30.0030.12711.36
4.4.20.0070.13711.36
4.4.10.0030.15711.36
4.4.00.0000.14011.36
4.3.110.0000.17011.36
4.3.100.0030.16011.36
4.3.90.0000.15011.36
4.3.80.0030.19711.36
4.3.70.0030.16711.36
4.3.60.0000.18711.36
4.3.50.0100.15311.36
4.3.40.0000.14011.36
4.3.30.0000.14311.36
4.3.20.0000.11011.36
4.3.10.0030.12711.36
4.3.00.0000.10011.36

preferences:
36.35 ms | 401 KiB | 5 Q