3v4l.org

run code in 300+ PHP versions simultaneously
<?php class factorial_of_a_number{ protected $_n; public function __construct($n){ if(!is_int($n)){ throw new InvalidArgumentException('Not a Number'); } $this->_n=$n; } function result(){ $factorial = 1; for($i=1;$i<=$this->_n;$i++){ $factorial *= $i } return $factorial; } } $objekt = new factorial_of_a_number(2); echo $objekt ->result();

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)
5.4.300.0080.03412.52
5.4.290.0030.04112.51
5.4.280.0020.03912.41
5.4.270.0070.03812.41
5.4.260.0020.04112.41
5.4.250.0060.03712.41
5.4.240.0100.03512.41
5.4.230.0140.04412.41
5.4.220.0130.03712.40
5.4.210.0080.04012.41
5.4.200.0050.05012.41
5.4.190.0080.03712.40
5.4.180.0080.04712.40
5.4.170.0080.05212.41
5.4.160.0070.05112.41
5.4.150.0080.04612.40
5.4.140.0060.03512.09
5.4.130.0050.03612.07
5.4.120.0070.03412.04
5.4.110.0060.03512.04
5.4.100.0050.03612.04
5.4.90.0080.03512.04
5.4.80.0070.03612.03
5.4.70.0110.03012.03
5.4.60.0050.03612.03
5.4.50.0050.03612.03
5.4.40.0070.03412.02
5.4.30.0060.03712.01
5.4.20.0050.03712.01
5.4.10.0060.04112.01
5.4.00.0080.04611.50
5.3.280.0060.05412.71
5.3.270.0070.04112.73
5.3.260.0080.05612.72
5.3.250.0060.03712.72
5.3.240.0080.03512.72
5.3.230.0080.03612.70
5.3.220.0080.05212.68
5.3.210.0080.03712.68
5.3.200.0040.03912.68
5.3.190.0070.03912.68
5.3.180.0060.03712.68
5.3.170.0090.04412.66
5.3.160.0130.04912.67
5.3.150.0090.04612.67
5.3.140.0060.05212.66
5.3.130.0050.05412.65
5.3.120.0050.04612.66
5.3.110.0110.05012.66
5.3.100.0100.04412.13
5.3.90.0060.03612.11
5.3.80.0110.04612.10
5.3.70.0080.05112.10
5.3.60.0060.05112.08
5.3.50.0080.04912.03
5.3.40.0120.04812.03
5.3.30.0060.03711.99
5.3.20.0100.04511.77
5.3.10.0030.04411.74
5.3.00.0050.03711.72

preferences:
142.6 ms | 1394 KiB | 7 Q