3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Hostnet\Component\Php7; /** * Simple number */ class Number { private $value; public function __construct($value) { $this->value = $value; } public function getValue() { return $this->value; } } /** * Simple calculator. */ class Calculator { /** * Sum the two arguments. * * @param Number $left the left operant * @param Number $right the right operant * @return Number the answer, the answer is Number(0) when one of the two arguments is null */ public function sum(Number $left = null, Number $right = null) { try { return new Number($left->getValue() + $right->getValue()); } catch (\Error $error) { return new Number(0); } } /** * Divisions two arguments. * * @param Number $left the left operant * @param Number $right the right operant * @return Number the answer, the answer is Number(0) when a devision by zero is made. */ public function division(Number $left, Number $right) { return new Number($left->getValue() / $right->getValue()); } } $item = new Calculator(); $item->sum(null, null);

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.60.0120.00618.30
8.3.50.0110.01118.34
8.3.40.0070.00718.82
8.3.30.0110.00318.68
8.3.20.0040.00420.25
8.3.10.0050.00320.65
8.3.00.0060.00320.57
8.2.180.0150.00318.41
8.2.170.0040.01122.96
8.2.160.0100.00320.52
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00419.36
8.2.120.0080.00026.35
8.2.110.0030.00721.04
8.2.100.0000.01117.63
8.2.90.0000.00819.23
8.2.80.0090.00017.97
8.2.70.0040.00417.25
8.2.60.0030.00617.90
8.2.50.0060.00318.09
8.2.40.0030.00720.42
8.2.30.0040.00419.38
8.2.20.0020.00517.63
8.2.10.0000.00718.07
8.2.00.0000.00917.99
8.1.280.0110.00425.92
8.1.270.0100.00023.84
8.1.260.0000.00728.09
8.1.250.0000.00828.09
8.1.240.0060.00322.10
8.1.230.0090.00317.70
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0100.00017.35
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0040.00418.56
8.1.160.0000.00822.72
8.1.150.0040.00418.80
8.1.140.0050.00319.46
8.1.130.0030.00317.56
8.1.120.0030.00517.40
8.1.110.0050.00217.29
8.1.100.0050.00217.29
8.1.90.0000.00717.47
8.1.80.0000.00817.41
8.1.70.0050.00317.41
8.1.60.0030.00517.56
8.1.50.0000.00817.56
8.1.40.0000.00817.56
8.1.30.0040.00417.54
8.1.20.0000.00717.64
8.1.10.0070.00017.63
8.1.00.0050.00317.57
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0030.00318.39
8.0.270.0070.00017.21
8.0.260.0070.00017.13
8.0.250.0030.00316.87
8.0.240.0040.00416.99
8.0.230.0070.00016.91
8.0.220.0080.00016.77
8.0.210.0000.00816.90
8.0.200.0000.00716.94
8.0.190.0040.00416.97
8.0.180.0020.00516.93
8.0.170.0030.00516.90
8.0.160.0000.00716.90
8.0.150.0070.00016.85
8.0.140.0030.00316.86
8.0.130.0030.00313.29
8.0.120.0040.00416.88
8.0.110.0040.00416.80
8.0.100.0040.00416.79
8.0.90.0040.00416.96
8.0.80.0000.01516.83
8.0.70.0050.00316.99
8.0.60.0000.00716.73
8.0.50.0030.00516.92
8.0.30.0100.00917.01
8.0.20.0130.00817.40
8.0.10.0070.00016.91
8.0.00.0110.00916.66
7.4.330.0000.00515.12
7.4.320.0030.00316.55
7.4.300.0060.00016.61
7.4.290.0030.00316.66
7.4.280.0090.00316.52
7.4.270.0000.00716.37
7.4.260.0030.00316.51
7.4.250.0000.00716.47
7.4.240.0000.00716.67
7.4.230.0000.00716.72
7.4.220.0130.01016.61
7.4.210.0030.01116.59
7.4.200.0000.00716.61
7.4.160.0090.00616.61
7.4.150.0120.00617.40
7.4.140.0140.00817.86
7.4.130.0080.01016.44
7.4.120.0110.00616.59
7.4.110.0070.01416.66
7.4.100.0050.00416.59
7.4.90.0030.01916.29
7.4.80.0090.00919.39
7.4.70.0090.00916.51
7.4.60.0090.00616.49
7.4.50.0130.00316.68
7.4.40.0080.01216.65
7.4.30.0060.01216.80
7.4.00.0030.01014.86
7.3.330.0030.00313.20
7.3.320.0000.00513.21
7.3.310.0000.00716.50
7.3.300.0000.00716.33
7.3.290.0000.00716.33
7.3.280.0090.00916.31
7.3.270.0120.00617.40
7.3.260.0170.00716.68
7.3.250.0070.01316.46
7.3.240.0110.01116.54
7.3.230.0140.00316.39
7.3.210.0150.00916.43
7.3.200.0100.01019.39
7.3.190.0170.00416.45
7.3.180.0100.00716.48
7.3.170.0140.00616.36
7.3.160.0110.00416.57
7.3.10.0100.00616.59
7.3.00.0060.00716.74
7.2.330.0070.01016.42
7.2.320.0190.00616.39
7.2.310.0140.00516.41
7.2.300.0070.01016.38
7.2.290.0160.00016.73
7.2.130.0100.00016.88
7.2.120.0060.00916.55
7.2.110.0130.00616.66
7.2.100.0070.00716.97
7.2.90.0130.01016.87
7.2.80.0190.00416.80
7.2.70.0220.00516.75
7.2.60.0120.00816.90
7.2.50.0060.01216.94
7.2.40.0160.00616.71
7.2.30.0090.00616.89
7.2.20.0070.01016.89
7.2.10.0180.00316.62
7.2.00.0070.00818.01
7.1.250.0070.00715.36
7.1.200.0000.01115.80
7.1.100.0040.00717.94
7.1.70.0080.00317.15
7.1.60.0070.01719.27
7.1.50.0060.01516.66
7.1.00.0030.07722.32
7.0.200.0000.00816.59
7.0.60.0230.05020.09
7.0.50.0030.04017.96
7.0.40.0030.08720.30
7.0.30.0430.06720.09
7.0.20.0370.06020.33
7.0.10.0100.08720.26
7.0.00.0030.05320.14
5.6.280.0030.07321.09
5.6.210.0000.08720.76
5.6.200.0030.04718.22
5.6.190.0100.08720.64
5.6.180.0100.05020.47
5.6.170.0300.07320.71
5.6.160.0030.10320.50
5.6.150.0130.06318.23
5.6.140.0070.06018.17
5.6.130.0000.04718.17
5.6.120.0030.05321.03
5.6.110.0230.05720.99
5.6.100.0070.08321.00
5.6.90.0100.06720.98
5.6.80.0070.05320.41
5.5.350.0400.06720.52
5.5.340.0000.08718.05
5.5.330.0070.03720.21
5.5.320.0170.05320.27
5.5.310.0270.07720.37
5.5.300.0100.07718.05
5.5.290.0100.08017.94
5.5.280.0100.07720.78
5.5.270.0100.05720.88
5.5.260.0030.04320.75
5.5.250.0070.08720.63
5.5.240.0030.08320.14

preferences:
33.57 ms | 400 KiB | 5 Q