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 = 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"; } } 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.3.10.0070.02017.54
7.3.00.0080.01817.54
7.2.130.0070.01917.88
7.2.120.0050.02117.93
7.2.110.0050.02617.74
7.2.100.0030.02317.93
7.2.90.0000.02717.80
7.2.80.0060.01917.83
7.2.70.0050.02117.99
7.2.60.0050.02217.77
7.2.50.0050.02517.83
7.2.40.0050.02217.85
7.2.30.0110.01917.99
7.2.20.0070.02017.82
7.2.10.0040.02417.91
7.2.00.0040.02118.76
7.1.250.0050.02816.85
7.1.240.0100.02916.81
7.1.230.0030.02716.70
7.1.220.0070.02416.73
7.1.210.0030.03116.94
7.1.200.0030.02816.83
7.1.190.0060.02516.92
7.1.180.0030.03516.86
7.1.170.0100.02716.70
7.1.160.0030.03116.73
7.1.150.0030.02716.67
7.1.140.0060.02316.74
7.1.130.0030.03016.75
7.1.120.0140.02016.66
7.1.110.0060.02816.85
7.1.100.0030.02916.84
7.1.90.0000.03116.83
7.1.80.0060.02916.69
7.1.70.0050.02517.51
7.1.60.0030.03418.32
7.1.50.0050.03517.22
7.1.40.0070.03016.65
7.1.30.0000.03616.57
7.1.20.0100.02416.75
7.1.10.0000.03816.67
7.1.00.0080.06019.97
7.0.330.0000.03616.23
7.0.320.0000.03016.25
7.0.310.0070.02416.34
7.0.300.0070.02516.12
7.0.290.0030.03416.61
7.0.280.0000.03216.22
7.0.270.0100.02416.19
7.0.260.0100.03316.20
7.0.250.0000.03616.48
7.0.240.0000.03516.07
7.0.230.0070.03016.26
7.0.220.0060.02516.36
7.0.210.0030.03216.43
7.0.200.0020.02516.83
7.0.190.0000.02816.05
7.0.180.0100.02316.22
7.0.170.0000.03316.25
7.0.160.0090.02116.14
7.0.150.0100.02316.08
7.0.140.0070.06019.43
7.0.130.0070.03116.43
7.0.120.0070.02816.25
7.0.110.0070.03016.23
7.0.100.0100.06418.54
7.0.90.0070.04518.33
7.0.80.0070.04518.47
7.0.70.0070.05018.49
7.0.60.0070.04818.44
7.0.50.0070.05918.62
7.0.40.0080.03717.39
7.0.30.0030.07017.51
7.0.20.0050.06417.51
7.0.10.0030.04617.45
7.0.00.0020.07017.41
5.6.380.0030.06715.38
5.6.370.0030.07315.83
5.6.360.0000.07215.61
5.6.350.0070.06715.31
5.6.340.0130.06215.58
5.6.330.0000.07315.91
5.6.320.0070.07215.46
5.6.310.0000.07315.45
5.6.300.0100.06415.41
5.6.290.0070.07015.46
5.6.280.0070.09518.88
5.6.270.0030.07815.49
5.6.260.0100.07015.66
5.6.250.0050.09518.70
5.6.240.0080.09418.62
5.6.230.0020.07718.52
5.6.220.0080.08918.58
5.6.210.0070.09218.46
5.6.200.0120.07218.76
5.6.190.0080.09418.69
5.6.180.0080.08118.81
5.6.170.0080.09518.78
5.6.160.0070.09618.64
5.6.150.0050.09818.70
5.6.140.0070.10018.76
5.6.130.0050.08018.82
5.6.120.0030.09918.60
5.6.110.0030.07018.63
5.6.100.0100.08818.66
5.6.90.0130.09618.79
5.6.80.0080.08818.39
5.6.70.0070.07318.30
5.6.60.0030.07518.43
5.6.50.0070.09218.49
5.6.40.0050.07218.34
5.6.30.0030.08318.26
5.6.20.0130.08718.32
5.6.10.0020.10418.27
5.6.00.0030.09918.34
5.5.380.0070.07816.88
5.5.370.0100.07416.73
5.5.360.0080.09816.68
5.5.350.0080.09816.81
5.5.340.0050.09916.91
5.5.330.0070.06717.06
5.5.320.0050.10217.04
5.5.310.0080.08517.06
5.5.300.0070.09817.07
5.5.290.0070.08617.02
5.5.280.0110.09416.97
5.5.270.0050.10316.92
5.5.260.0050.07816.95
5.5.250.0050.09116.77
5.5.240.0100.07016.76
5.5.230.0020.07316.45
5.5.220.0080.08116.56
5.5.210.0070.07516.74
5.5.200.0030.07916.70
5.5.190.0030.09016.63
5.5.180.0070.08616.65
5.5.170.0030.06912.36
5.5.160.0080.10016.61
5.5.150.0020.10016.70
5.5.140.0100.06716.71
5.5.130.0100.08716.54
5.5.120.0020.07016.56
5.5.110.0080.09016.70
5.5.100.0070.09916.53
5.5.90.0070.09516.71
5.5.80.0070.06616.60
5.5.70.0050.09916.48
5.5.60.0070.09516.39
5.5.50.0050.07316.57
5.5.40.0050.09416.41
5.5.30.0100.09516.43
5.5.20.0070.07016.34
5.5.10.0080.06616.63
5.5.00.0080.06816.33
5.4.450.0070.07616.16
5.4.440.0020.10316.21
5.4.430.0050.09516.26
5.4.420.0080.11116.16
5.4.410.0030.09216.07
5.4.400.0100.09116.07
5.4.390.0050.07216.16
5.4.380.0030.10415.93
5.4.370.0130.06315.86
5.4.360.0050.07415.97
5.4.350.0070.07715.92
5.4.340.0100.08915.84
5.4.330.0030.06912.10
5.4.320.0050.07816.12
5.4.310.0030.08616.09
5.4.300.0080.09215.79
5.4.290.0070.09815.84
5.4.280.0050.07415.93
5.4.270.0020.08315.92
5.4.260.0030.09915.86
5.4.250.0050.09115.97
5.4.240.0080.08915.95
5.4.230.0100.09215.90
5.4.220.0070.07216.07
5.4.210.0100.08016.04
5.4.200.0050.09015.95
5.4.190.0070.08716.12
5.4.180.0080.07515.77
5.4.170.0020.07815.96
5.4.160.0030.07316.05
5.4.150.0070.08715.88
5.4.140.0050.10114.58
5.4.130.0100.09214.75
5.4.120.0030.09514.49
5.4.110.0130.08914.56
5.4.100.0050.09214.81
5.4.90.0020.10014.77
5.4.80.0080.09214.58
5.4.70.0080.07414.54
5.4.60.0050.07614.52
5.4.50.0070.09914.57
5.4.40.0020.09214.33
5.4.30.0120.09114.54
5.4.20.0070.09414.53
5.4.10.0050.07714.51
5.4.00.0080.07014.21
5.3.290.0030.10413.73
5.3.280.0050.10413.68
5.3.270.0030.07513.71
5.3.260.0030.07413.63
5.3.250.0080.08213.71
5.3.240.0050.08613.62
5.3.230.0080.09413.52
5.3.220.0120.06613.57
5.3.210.0080.07713.57
5.3.200.0080.08813.57
5.3.190.0050.10513.54
5.3.180.0070.10113.56
5.3.170.0070.08313.50
5.3.160.0070.09313.58
5.3.150.0100.08013.49
5.3.140.0070.09513.60
5.3.130.0050.10213.42
5.3.120.0030.09513.49
5.3.110.0030.10413.59
5.3.100.0030.08313.34
5.3.90.0050.10013.13
5.3.80.0020.09213.22
5.3.70.0080.09713.23
5.3.60.0070.09713.35
5.3.50.0050.09913.23
5.3.40.0050.10213.21
5.3.30.0020.10213.28
5.3.20.0070.08213.23
5.3.10.0030.10513.12
5.3.00.0030.10513.12
5.2.170.0020.10412.66
5.2.160.0000.10912.72
5.2.150.0030.09312.77
5.2.140.0070.09112.70
5.2.130.0070.10412.66
5.2.120.0030.09512.66
5.2.110.0080.10512.71
5.2.100.0050.09912.67
5.2.90.0020.11212.68
5.2.80.0050.10512.66
5.2.70.0050.11112.66
5.2.60.0030.12112.66
5.2.50.0030.11812.66
5.2.40.0050.10512.67
5.2.30.0050.08412.66
5.2.20.0030.09512.66
5.2.10.0020.10512.66
5.2.00.0050.11012.66
5.1.60.0070.10712.66
5.1.50.0020.11512.66
5.1.40.0000.11112.66
5.1.30.0030.11512.66
5.1.20.0030.10812.66
5.1.10.0030.10812.66
5.1.00.0030.10612.66
5.0.50.0020.20012.66
5.0.40.0020.20012.66
5.0.30.0000.21412.66
5.0.20.0050.18812.66
5.0.10.0030.19512.66
5.0.00.0020.20412.66
4.4.90.0020.20212.66
4.4.80.0030.18412.66
4.4.70.0020.18512.66
4.4.60.0000.17012.66
4.4.50.0000.18512.66
4.4.40.0020.18312.66
4.4.30.0020.19912.66
4.4.20.0050.18612.66
4.4.10.0020.18112.66
4.4.00.0020.20012.66
4.3.110.0020.19112.66
4.3.100.0020.17812.66
4.3.90.0030.19312.66
4.3.80.0020.19412.66
4.3.70.0000.20812.66
4.3.60.0000.20612.66
4.3.50.0000.19012.66
4.3.40.0020.18212.66
4.3.30.0030.18312.66
4.3.20.0030.17812.66
4.3.10.0020.17312.66
4.3.00.0020.18112.66

preferences:
36.15 ms | 401 KiB | 5 Q