3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Factorial { public function calculate ($int) { if (!is_int($int)) { echo "entry is not a number"; } $intStep = $int - 1; do { $int += $intStep; $intStep--; } while ($intStep > 0); return $int; } } $factorial = new Factorial; echo $factorial->calculate(5);

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)
8.3.70.0120.00316.88
8.3.60.0070.00718.68
8.3.50.0070.01120.08
8.3.40.0120.00318.67
8.3.30.0090.00618.64
8.3.20.0070.00021.76
8.3.10.0030.00623.67
8.3.00.0000.00723.65
8.2.190.0110.00316.63
8.2.180.0070.01125.92
8.2.170.0030.01419.02
8.2.160.0070.00722.96
8.2.150.0000.00725.66
8.2.140.0110.00324.66
8.2.130.0080.00019.77
8.2.120.0070.00026.35
8.2.110.0070.00322.29
8.2.100.0070.00417.84
8.2.90.0080.00317.84
8.2.80.0040.00417.97
8.2.70.0050.00318.16
8.2.60.0090.00018.16
8.2.50.0040.00418.10
8.2.40.0040.00419.48
8.2.30.0000.00819.18
8.2.20.0000.00718.24
8.2.10.0000.00720.61
8.2.00.0030.00519.48
8.1.280.0040.01425.92
8.1.270.0030.00618.83
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0050.00519.26
8.1.230.0080.00320.97
8.1.220.0080.00017.74
8.1.210.0000.00818.96
8.1.200.0060.00317.35
8.1.190.0000.00720.15
8.1.180.0000.00718.10
8.1.170.0060.00318.64
8.1.160.0020.00518.89
8.1.150.0070.00018.77
8.1.140.0030.00322.09
8.1.130.0000.00720.15
8.1.120.0000.00717.45
8.1.110.0040.00417.45
8.1.100.0000.00817.38
8.1.90.0040.00417.45
8.1.80.0060.00317.51
8.1.70.0050.00217.39
8.1.60.0040.00417.50
8.1.50.0040.00417.56
8.1.40.0000.00817.56
8.1.30.0110.00017.69
8.1.20.0040.00417.65
8.1.10.0000.00817.56
8.1.00.0030.00517.48
8.0.300.0060.00319.98
8.0.290.0000.00816.58
8.0.280.0070.00018.45
8.0.270.0030.00317.35
8.0.260.0030.00320.24
8.0.250.0000.00717.00
8.0.240.0030.00516.84
8.0.230.0040.00416.86
8.0.220.0040.00416.81
8.0.210.0000.00716.88
8.0.200.0000.00816.94
8.0.190.0030.00516.95
8.0.180.0080.00016.80
8.0.170.0000.00916.90
8.0.160.0070.00016.85
8.0.150.0000.00716.89
8.0.140.0040.00416.72
8.0.130.0030.00313.32
8.0.120.0000.00716.75
8.0.110.0040.00416.93
8.0.100.0070.00016.88
8.0.90.0020.00516.78
8.0.80.0070.01116.86
8.0.70.0000.00716.78
8.0.60.0050.00217.01
8.0.50.0030.00516.85
8.0.30.0120.00717.04
8.0.20.0160.00317.40
8.0.10.0000.00716.98
8.0.00.0110.00616.59
7.4.330.0000.00616.82
7.4.320.0000.00616.48
7.4.300.0030.00316.63
7.4.290.0040.00416.65
7.4.280.0030.00616.50
7.4.270.0030.00316.60
7.4.260.0040.00416.49
7.4.250.0000.00716.54
7.4.240.0030.00316.50
7.4.230.0030.00316.51
7.4.220.0050.00316.64
7.4.210.0070.00716.55
7.4.200.0040.00416.41
7.4.160.0080.00816.54
7.4.140.0120.00717.86
7.4.130.0130.00916.68
7.4.120.0000.01816.50
7.4.110.0120.00416.49
7.4.100.0170.00716.61
7.4.90.0030.01416.52
7.4.80.0070.01619.39
7.4.70.0060.01016.46
7.4.60.0070.00716.36
7.4.50.0080.00516.58
7.4.40.0030.01416.42
7.4.00.0090.00614.89
7.3.330.0050.00013.21
7.3.320.0000.00713.20
7.3.310.0030.00316.47
7.3.300.0000.00616.41
7.3.290.0030.00316.20
7.3.280.0080.00716.33
7.3.260.0060.01116.49
7.3.240.0140.00516.52
7.3.230.0030.01416.62
7.3.210.0110.00516.49
7.3.200.0090.01216.24
7.3.190.0100.00616.45
7.3.180.0070.01016.46
7.3.170.0060.01616.38
7.3.160.0040.01816.48
7.3.00.0460.00314.53
7.2.330.0090.00816.61
7.2.320.0090.01216.71
7.2.310.0070.01016.52
7.2.300.0060.01616.67
7.2.290.0110.00816.77
7.2.130.0710.00314.88
7.2.120.0480.00714.84
7.2.110.0530.01014.68
7.2.100.0520.00614.76
7.2.90.0290.01114.91
7.2.80.0370.00314.85
7.2.70.0260.01014.97
7.2.60.0300.00715.15
7.2.50.1000.00315.15
7.2.40.0480.00315.16
7.2.30.0300.00314.74
7.2.20.0310.00315.03
7.2.10.0310.01015.11
7.2.00.0400.00315.09
7.1.250.0540.00613.59
7.0.330.0450.00613.55
5.6.380.0090.00614.29

preferences:
33.81 ms | 401 KiB | 5 Q