3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Factoriel {public function calculate() { if(func_num_args() != 1) throw new Exception ("Invalid arguments count for method calculate!"); if(($n = (int)func_get_arg(0)) <= 0) throw new Exception ("Invalid argument supplied for method calculate!"); $result = 1; foreach(range(1, $n) as $current) $result = $this->multiply ($result, $current); return $result;}private function multiply($left, $right) { return bcmul("$left", "$right"); }}$factoriel = new Factoriel();echo $factoriel->calculate(1500);?>
based on OdQWQ

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.0rc40.0310.03498.97
7.3.0rc30.0560.03216.52
5.5.150.0100.00510.93
5.5.140.0030.01311.04
5.5.130.0080.00610.94
5.5.120.0090.00610.87
5.5.110.0110.00411.35
5.5.100.0100.00311.20
5.5.90.0090.00711.29
5.5.80.0070.00811.04
5.5.70.0100.00511.18
5.5.60.0070.00711.27
5.5.50.0110.00411.29
5.5.40.0080.00811.14
5.5.30.0070.00711.23
5.5.20.0100.00511.04
5.5.10.0030.00911.14
5.5.00.0110.00611.23
5.4.310.0060.00711.02
5.4.300.0130.00310.84
5.4.290.0100.00511.07
5.4.280.0000.01311.04
5.4.270.0080.00910.99
5.4.260.0130.00310.84
5.4.250.0140.00011.25
5.4.240.0100.00611.04
5.4.230.0110.00611.22
5.4.220.0110.00610.93
5.4.210.0090.00310.90
5.4.200.0120.00210.97
5.4.190.0000.01411.08
5.4.180.0100.00310.94
5.4.170.0140.00311.08
5.4.160.0050.00810.93
5.4.150.0140.00310.81
5.4.140.0120.00311.09
5.4.130.0140.00011.05
5.4.120.0040.00811.11
5.4.110.0060.00911.05
5.4.100.0130.00311.03
5.4.90.0100.00511.15
5.4.80.0100.00511.02
5.4.70.0160.00011.09
5.4.60.0040.01311.18
5.4.50.0100.00310.99
5.4.40.0090.00311.09
5.4.30.0110.00311.09
5.4.20.0140.00210.97
5.4.10.0050.01011.21
5.4.00.0120.00211.15
5.3.280.0060.03510.91
5.3.270.0070.05510.92
5.3.260.0030.05910.76
5.3.250.0160.02510.71
5.3.240.0130.02910.68
5.3.230.0100.03610.70
5.3.220.0070.03810.78
5.3.210.0070.04710.74
5.3.200.0100.04210.74
5.3.190.0070.04210.59
5.3.180.0100.03511.00
5.3.170.0130.02910.98
5.3.160.0130.04910.98
5.3.150.0070.03710.76
5.3.140.0030.03710.82
5.3.130.0110.03210.86
5.3.120.0110.02810.91
5.3.110.0040.04610.88
5.3.100.0100.03610.91
5.3.90.0100.02610.94
5.3.80.0100.03510.79
5.3.70.0130.04310.75
5.3.60.0030.03510.62
5.3.50.0070.04910.81
5.3.40.0030.03610.67
5.3.30.0130.04510.74
5.3.20.0110.03210.66
5.3.10.0070.03010.69
5.3.00.0120.03210.68
5.2.170.0000.0369.94
5.2.160.0000.0429.93
5.2.150.0040.0369.64
5.2.140.0140.0419.86
5.2.130.0100.0409.75
5.2.120.0040.0379.81
5.2.110.0120.0269.80
5.2.100.0100.0319.58
5.2.90.0130.0299.76
5.2.80.0120.0319.46
5.2.70.0040.0519.73
5.2.60.0100.0299.63
5.2.50.0060.0369.71
5.2.40.0100.0309.73
5.2.30.0070.0439.67
5.2.20.0100.0299.55
5.2.10.0060.0329.48
5.2.00.0080.0319.39
5.1.60.0070.0308.86
5.1.50.0070.0338.84
5.1.40.0040.0378.97
5.1.30.0060.0379.00
5.1.20.0030.0418.84
5.1.10.0070.0338.94
5.1.00.0070.0428.84
5.0.50.0020.0548.84
5.0.40.0030.0548.84
5.0.30.0060.0528.84
5.0.20.0000.0428.84
5.0.10.0070.0418.84
5.0.00.0090.0448.84
4.4.90.0030.0038.84
4.4.80.0030.0038.84
4.4.70.0080.0008.84
4.4.60.0030.0038.84
4.4.50.0050.0028.84
4.4.40.0020.0048.84
4.4.30.0060.0008.84
4.4.20.0040.0028.84
4.4.10.0050.0028.84
4.4.00.0060.0008.84
4.3.110.0030.0058.84
4.3.100.0070.0008.84
4.3.90.0040.0028.84
4.3.80.0060.0008.84
4.3.70.0070.0008.84
4.3.60.0030.0038.84
4.3.50.0040.0048.84
4.3.40.0030.0038.84
4.3.30.0030.0038.84
4.3.20.0040.0018.84
4.3.10.0000.0058.84
4.3.00.0030.0038.84