3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyCalculator { private $_fval, $_sval; public function __construct( $fval, $sval ) { $this->_fval = $fval; $this->_sval = $sval; } public function add() { return $this->_fval + $this->_sval; } public function subtract() { return $this->_fval - $this->_sval; } public function multiply() { return $this->_fval * $this->_sval; } public function divide() { return $this->_fval / $this->_sval; } } $mycalc = new MyCalculator(12, 6); echo $mycalc-> add(); // Displays 18 echo '/n'.$mycalc-> multiply(); // Displays 72 echo '/n'.$mycalc-> subtract(); // Displays 6 echo '\n'.$mycalc-> divide(); // Displays 2 ?>

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.0090.00616.88
8.3.50.0140.00622.10
8.3.40.0070.00718.77
8.3.30.0130.00319.09
8.3.20.0050.00220.20
8.3.10.0040.00423.59
8.3.00.0040.00419.38
8.2.180.0090.00618.16
8.2.170.0070.00722.96
8.2.160.0100.00320.57
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.46
8.2.110.0060.00322.12
8.2.100.0090.00317.78
8.2.90.0040.00419.13
8.2.80.0000.00817.97
8.2.70.0000.00917.50
8.2.60.0000.00818.04
8.2.50.0040.00418.07
8.2.40.0000.00819.82
8.2.30.0000.00717.95
8.2.20.0000.00717.68
8.2.10.0040.00417.96
8.2.00.0000.00817.75
8.1.280.0160.00325.92
8.1.270.0040.00423.89
8.1.260.0000.00826.35
8.1.250.0090.00028.09
8.1.240.0060.00323.84
8.1.230.0030.00919.21
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0060.00317.48
8.1.190.0050.00317.66
8.1.180.0060.00319.01
8.1.170.0000.00918.46
8.1.160.0000.00721.96
8.1.150.0040.00418.57
8.1.140.0040.00417.31
8.1.130.0070.00017.75
8.1.120.0070.00017.36
8.1.110.0030.00617.46
8.1.100.0040.00417.41
8.1.90.0040.00417.35
8.1.80.0000.00717.32
8.1.70.0030.00617.36
8.1.60.0040.00417.57
8.1.50.0000.00817.55
8.1.40.0020.00517.48
8.1.30.0030.00517.61
8.1.20.0040.00417.59
8.1.10.0070.00017.66
8.1.00.0040.00417.48
8.0.300.0040.00419.21
8.0.290.0000.00817.04
8.0.280.0000.00718.37
8.0.270.0000.00717.30
8.0.260.0030.00317.23
8.0.250.0040.00416.90
8.0.240.0030.00616.91
8.0.230.0030.00517.00
8.0.220.0040.00416.93
8.0.210.0000.00816.77
8.0.200.0000.00716.93
8.0.190.0040.00416.94
8.0.180.0040.00416.77
8.0.170.0040.00416.97
8.0.160.0000.00716.84
8.0.150.0000.00716.88
8.0.140.0040.00316.79
8.0.130.0000.00613.27
8.0.120.0040.00416.90
8.0.110.0070.00016.83
8.0.100.0070.00016.83
8.0.90.0070.00016.86
8.0.80.0030.01316.79
8.0.70.0000.00716.96
8.0.60.0040.00416.91
8.0.50.0000.00816.71
8.0.30.0110.00717.36
8.0.20.0070.01217.40
8.0.10.0000.00816.96
8.0.00.0110.01016.98
7.4.330.0050.00015.02
7.4.320.0030.00316.54
7.4.300.0000.00616.61
7.4.290.0000.00716.61
7.4.280.0000.00816.46
7.4.270.0050.00216.52
7.4.260.0000.00716.49
7.4.250.0050.00316.57
7.4.240.0030.00416.55
7.4.230.0030.00316.64
7.4.220.0090.00916.69
7.4.210.0080.00916.54
7.4.200.0030.00316.52
7.4.190.0000.00716.58
7.4.160.0110.00316.48
7.4.150.0070.01017.40
7.4.140.0080.01017.86
7.4.130.0110.00916.55
7.4.120.0070.01616.45
7.4.110.0110.00616.39
7.4.100.0130.01316.57
7.4.90.0130.01016.60
7.4.80.0070.01419.39
7.4.70.0090.00916.58
7.4.60.0050.01016.38
7.4.50.0040.00416.45
7.4.40.0070.00722.77
7.4.30.0090.00616.68
7.4.00.0030.01415.11
7.3.330.0060.00013.30
7.3.320.0000.00613.22
7.3.310.0070.00016.32
7.3.300.0070.00016.25
7.3.290.0040.01116.27
7.3.280.0080.01116.29
7.3.270.0060.01017.40
7.3.260.0060.01316.46
7.3.250.0130.00716.39
7.3.240.0130.00616.29
7.3.230.0130.00316.39
7.3.210.0070.01016.52
7.3.200.0110.00719.39
7.3.190.0180.00316.29
7.3.180.0160.00016.21
7.3.170.0060.00916.28
7.3.160.0100.00616.59
7.3.120.0030.01314.95
7.2.330.0140.00316.72
7.2.320.0080.00816.64
7.2.310.0130.00316.82
7.2.300.0060.01216.45
7.2.290.0070.01016.84
7.2.00.0070.00719.41
7.1.100.0000.01117.93
7.1.70.0070.01017.24
7.1.60.0090.01619.46
7.1.50.0060.00916.95
7.1.00.0100.07322.33
7.0.200.0060.00614.72
7.0.140.0000.07722.00
7.0.60.0130.06719.83
7.0.50.0030.08317.89
7.0.40.0070.07019.96
7.0.30.0230.03720.18
7.0.20.0200.05320.21
7.0.10.0030.04720.26
7.0.00.0070.08320.19
5.6.280.0070.07021.08
5.6.210.0030.06020.67
5.6.200.0170.07718.23
5.6.190.0070.08020.41
5.6.180.0200.05720.61
5.6.170.0200.07020.55
5.6.160.0100.07320.52
5.6.150.0100.04018.16
5.6.140.0030.06018.17
5.6.130.0070.08318.18
5.6.120.0170.07721.04
5.6.110.0130.07721.14
5.6.100.0030.08021.01
5.6.90.0130.07720.95
5.6.80.0130.07020.41
5.6.70.4570.03020.43
5.5.350.0230.04020.30
5.5.340.0000.04318.00
5.5.330.0070.06720.21
5.5.320.0270.06720.32
5.5.310.0100.05320.27
5.5.300.0070.07718.06
5.5.290.0070.08317.92
5.5.280.0100.08020.80
5.5.270.0100.08020.80
5.5.260.0000.09320.98
5.5.250.0100.08320.62
5.5.240.0270.06720.24
5.4.450.0570.06719.66
5.4.440.0900.06019.32
5.4.430.0200.04319.66
5.4.420.0970.05719.46
5.4.410.0700.06319.47
5.4.400.1000.04319.30
5.4.390.0670.05319.15
5.4.380.0370.06318.78
5.4.370.0330.05718.45
5.4.360.0400.06718.47
5.4.350.0370.06718.63
5.4.340.0430.04718.78
5.4.320.0050.04012.50
5.4.310.0060.04112.50
5.4.300.0070.03712.50
5.4.290.0070.05112.48
5.4.280.0070.03912.38
5.4.270.0050.04312.39
5.4.260.0060.03912.39
5.4.250.0040.04612.38
5.4.240.0070.03712.38
5.4.230.0060.03912.38
5.4.220.0090.03312.37
5.4.210.0080.03812.38
5.4.200.0060.04412.38
5.4.190.0140.04012.37
5.4.180.0060.04212.37
5.4.170.0100.04512.38
5.4.160.0070.03512.38
5.4.150.0030.04212.38
5.4.140.0040.04112.06
5.4.130.0050.03812.05
5.4.120.0100.03412.00
5.4.110.0020.04212.00
5.4.100.0050.03612.00
5.4.90.0070.03612.00
5.4.80.0030.04412.00
5.4.70.0050.03612.00
5.4.60.0050.03611.99
5.4.50.0050.03611.99
5.4.40.0060.03411.98
5.4.30.0100.04611.98
5.4.20.0080.04111.98
5.4.10.0090.03311.98
5.4.00.0060.04811.47
5.3.290.0080.04612.80
5.3.280.0070.04912.71
5.3.270.0100.04012.73
5.3.260.0060.04012.72
5.3.250.0060.03812.72
5.3.240.0070.05412.72
5.3.230.0090.03912.71
5.3.220.0130.04512.68
5.3.210.0100.04012.68
5.3.200.0080.04412.68
5.3.190.0130.04112.68
5.3.180.0050.04212.68
5.3.170.0050.03712.67
5.3.160.0070.03612.68
5.3.150.0070.03812.67
5.3.140.0110.03212.66
5.3.130.0110.05412.65
5.3.120.0080.04712.66
5.3.110.0120.07012.65
5.3.100.0090.05012.13
5.3.90.0060.07712.11
5.3.80.0080.06412.10
5.3.70.0060.04212.10
5.3.60.0090.03712.09
5.3.50.0060.03712.03
5.3.40.0080.03812.03
5.3.30.0070.04611.99
5.3.20.0080.04511.77
5.3.10.0090.04711.74
5.3.00.0110.04611.72
5.2.170.0070.0449.23
5.2.160.0060.0409.23
5.2.150.0070.0319.23
5.2.140.0070.0429.22
5.2.130.0030.0409.19
5.2.120.0040.0319.18
5.2.110.0040.0319.19
5.2.100.0040.0309.19
5.2.90.0070.0279.19
5.2.80.0050.0349.18
5.2.70.0090.0389.19
5.2.60.0130.0389.14
5.2.50.0090.0369.10
5.2.40.0080.0299.08
5.2.30.0040.0349.06
5.2.20.0040.0319.05
5.2.10.0060.0288.95
5.2.00.0050.0298.82
5.1.60.0040.0258.10
5.1.50.0010.0298.10
5.1.40.0060.0238.08
5.1.30.0050.0258.42
5.1.20.0040.0278.45
5.1.10.0040.0338.17
5.1.00.0070.0348.18
5.0.50.0060.0226.65
5.0.40.0010.0236.51
5.0.30.0020.0386.32
5.0.20.0030.0206.29
5.0.10.0040.0206.27
5.0.00.0060.0296.26
4.4.90.0020.0164.77
4.4.80.0030.0154.76
4.4.70.0020.0174.75
4.4.60.0040.0144.75
4.4.50.0020.0174.77
4.4.40.0040.0344.71
4.4.30.0050.0204.76
4.4.20.0030.0234.84
4.4.10.0030.0174.85
4.4.00.0030.0344.76
4.3.110.0020.0244.67
4.3.100.0070.0184.66
4.3.90.0020.0234.63
4.3.80.0030.0344.58
4.3.70.0030.0214.63
4.3.60.0030.0224.63
4.3.50.0030.0164.63
4.3.40.0020.0254.54
4.3.30.0020.0163.30
4.3.20.0020.0173.28
4.3.10.0020.0173.23
4.3.00.0270.03010.54

preferences:
50.18 ms | 401 KiB | 5 Q