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.40.0070.00718.66
8.3.30.0070.00719.05
8.3.20.0040.00420.29
8.3.10.0040.00423.61
8.3.00.0050.00319.25
8.2.170.0110.00422.96
8.2.160.0030.01020.55
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0000.00822.24
8.2.110.0060.00322.07
8.2.100.0090.00317.91
8.2.90.0000.00817.84
8.2.80.0040.00417.97
8.2.70.0030.00717.38
8.2.60.0080.00017.92
8.2.50.0030.00518.07
8.2.40.0030.00519.95
8.2.30.0040.00418.06
8.2.20.0000.00817.74
8.2.10.0050.00218.05
8.2.00.0030.00617.69
8.1.270.0060.00323.84
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0090.00022.51
8.1.230.0040.00720.90
8.1.220.0040.00417.74
8.1.210.0080.00018.86
8.1.200.0040.00417.35
8.1.190.0060.00317.41
8.1.180.0040.00418.10
8.1.170.0000.00818.47
8.1.160.0040.00422.01
8.1.150.0000.00718.58
8.1.140.0040.00417.45
8.1.130.0000.00717.84
8.1.120.0030.00317.41
8.1.110.0080.00317.40
8.1.100.0000.00917.45
8.1.90.0070.00017.43
8.1.80.0070.00017.39
8.1.70.0000.00717.35
8.1.60.0000.00817.43
8.1.50.0050.00317.50
8.1.40.0080.00017.52
8.1.30.0040.00417.54
8.1.20.0050.00217.70
8.1.10.0040.00417.47
8.1.00.0040.00417.59
8.0.300.0000.00719.98
8.0.290.0050.00217.05
8.0.280.0070.00018.34
8.0.270.0030.00317.27
8.0.260.0030.00317.14
8.0.250.0040.00416.95
8.0.240.0040.00417.02
8.0.230.0070.00016.99
8.0.220.0000.00716.86
8.0.210.0000.00716.77
8.0.200.0000.00616.97
8.0.190.0030.00516.92
8.0.180.0040.00416.91
8.0.170.0000.00816.85
8.0.160.0040.00416.95
8.0.150.0040.00416.85
8.0.140.0040.00416.89
8.0.130.0030.00313.29
8.0.120.0040.00416.82
8.0.110.0040.00416.70
8.0.100.0000.00716.88
8.0.90.0040.00416.78
8.0.80.0090.00716.85
8.0.70.0000.00816.74
8.0.60.0040.00416.80
8.0.50.0040.00416.64
8.0.30.0110.00717.18
8.0.20.0130.00517.40
8.0.10.0040.00417.00
8.0.00.0090.00916.67
7.4.330.0000.00515.00
7.4.320.0030.00316.54
7.4.300.0000.00616.53
7.4.290.0070.00316.53
7.4.280.0040.00416.45
7.4.270.0070.00016.45
7.4.260.0080.00316.42
7.4.250.0040.00416.39
7.4.240.0050.00316.55
7.4.230.0070.00016.45
7.4.220.0060.01316.45
7.4.210.0050.01016.56
7.4.200.0030.00616.64
7.4.190.0000.00716.43
7.4.160.0050.01016.35
7.4.150.0090.00917.40
7.4.140.0130.00617.86
7.4.130.0080.00816.49
7.4.120.0050.01316.50
7.4.110.0030.01316.50
7.4.100.0120.00616.34
7.4.90.0120.00616.41
7.4.80.0040.01219.39
7.4.70.0110.00716.48
7.4.60.0120.00416.39
7.4.50.0040.00416.62
7.4.40.0130.00322.77
7.4.30.0130.00316.48
7.4.00.0100.00714.85
7.3.330.0060.00013.12
7.3.320.0030.00513.32
7.3.310.0050.00216.33
7.3.300.0000.00716.23
7.3.290.0100.00316.32
7.3.280.0090.00916.36
7.3.270.0070.01017.40
7.3.260.0150.00616.50
7.3.250.0120.00716.44
7.3.240.0100.00916.24
7.3.230.0090.00916.39
7.3.210.0180.00316.34
7.3.200.0120.01119.39
7.3.190.0090.00916.55
7.3.180.0140.00816.26
7.3.170.0140.00316.48
7.3.160.0080.01216.43
7.3.120.0070.00714.91
7.2.330.0120.00616.71
7.2.320.0040.01616.47
7.2.310.0130.00316.83
7.2.300.0030.01416.37
7.2.290.0080.00816.61
7.2.00.0060.00619.48
7.1.200.0000.01315.57
7.1.100.0030.00618.27
7.1.70.0060.00317.20
7.1.60.0140.01119.46
7.1.50.0070.01316.95
7.1.00.0030.07722.30
7.0.200.0150.00014.84
7.0.140.0030.07322.01
7.0.60.0070.04019.96
7.0.50.0070.07317.87
7.0.40.0030.09720.11
7.0.30.0230.04720.24
7.0.20.0130.08720.06
7.0.10.0070.06320.22
7.0.00.0030.04020.14
5.6.280.0070.07320.91
5.6.210.0170.04020.68
5.6.200.0000.09018.15
5.6.190.0030.05720.45
5.6.180.0300.06720.67
5.6.170.0400.06320.52
5.6.160.0000.05020.60
5.6.150.0130.07718.15
5.6.140.0070.03718.28
5.6.130.0000.04318.15
5.6.120.0130.06321.01
5.6.110.0100.08320.98
5.6.100.0070.07720.96
5.6.90.0170.07321.08
5.6.80.0170.06320.38
5.6.70.4470.04320.50
5.5.350.0270.08020.51
5.5.340.0100.05318.02
5.5.330.0070.04320.41
5.5.320.0130.04720.42
5.5.310.0200.06020.37
5.5.300.0070.04017.95
5.5.290.0030.05018.07
5.5.280.0100.08020.95
5.5.270.0070.07320.77
5.5.260.0100.05720.96
5.5.250.0070.08320.59
5.5.240.0200.06720.13
5.4.450.0700.05019.45
5.4.440.0670.06719.46
5.4.430.0100.05719.36
5.4.420.0700.06719.29
5.4.410.1030.05719.35
5.4.400.0170.05719.01
5.4.390.0900.04319.27
5.4.380.0300.05718.77
5.4.370.0330.05318.72
5.4.360.0470.05718.75
5.4.350.0230.07018.84
5.4.340.0330.05318.75
5.4.320.0100.03912.50
5.4.310.0050.04012.50
5.4.300.0080.03412.50
5.4.290.0090.04012.48
5.4.280.0040.04012.39
5.4.270.0060.03912.38
5.4.260.0070.03812.38
5.4.250.0070.04612.38
5.4.240.0070.04112.38
5.4.230.0110.03612.38
5.4.220.0090.03712.37
5.4.210.0100.03412.38
5.4.200.0060.04112.37
5.4.190.0060.05112.37
5.4.180.0100.04412.37
5.4.170.0050.04312.38
5.4.160.0110.03312.38
5.4.150.0030.04012.38
5.4.140.0070.03912.05
5.4.130.0050.04112.05
5.4.120.0090.03412.00
5.4.110.0040.04212.00
5.4.100.0100.04312.00
5.4.90.0100.04012.00
5.4.80.0110.05012.00
5.4.70.0100.04712.00
5.4.60.0070.05112.00
5.4.50.0070.05212.00
5.4.40.0070.05111.98
5.4.30.0090.04811.98
5.4.20.0080.03911.98
5.4.10.0070.03511.98
5.4.00.0060.03511.47
5.3.290.0070.03712.80
5.3.280.0060.04212.70
5.3.270.0110.03812.72
5.3.260.0060.04112.72
5.3.250.0060.03912.72
5.3.240.0080.03712.71
5.3.230.0080.03912.71
5.3.220.0080.03712.68
5.3.210.0100.04512.68
5.3.200.0110.04112.68
5.3.190.0100.04012.67
5.3.180.0130.03812.67
5.3.170.0080.04512.67
5.3.160.0070.03612.67
5.3.150.0050.03812.67
5.3.140.0100.03312.66
5.3.130.0050.04112.66
5.3.120.0030.04712.66
5.3.110.0120.04612.66
5.3.100.0060.03812.13
5.3.90.0070.05612.11
5.3.80.0090.03712.10
5.3.70.0070.03712.10
5.3.60.0060.03812.09
5.3.50.0060.03812.03
5.3.40.0070.04612.03
5.3.30.0060.05012.00
5.3.20.0080.04811.77
5.3.10.0060.03611.74
5.3.00.0070.04911.72
5.2.170.0060.0369.22
5.2.160.0040.0329.23
5.2.150.0090.0289.23
5.2.140.0090.0309.23
5.2.130.0060.0369.19
5.2.120.0050.0369.19
5.2.110.0090.0399.19
5.2.100.0060.0449.19
5.2.90.0080.0409.19
5.2.80.0070.0369.19
5.2.70.0040.0319.18
5.2.60.0080.0309.14
5.2.50.0040.0329.10
5.2.40.0040.0309.08
5.2.30.0030.0329.06
5.2.20.0040.0309.04
5.2.10.0050.0298.95
5.2.00.0040.0308.82
5.1.60.0040.0258.10
5.1.50.0070.0278.10
5.1.40.0020.0288.08
5.1.30.0040.0278.43
5.1.20.0050.0278.45
5.1.10.0080.0238.18
5.1.00.0040.0268.18
5.0.50.0030.0226.64
5.0.40.0060.0186.52
5.0.30.0060.0296.32
5.0.20.0080.0156.29
5.0.10.0050.0216.27
5.0.00.0030.0366.27
4.4.90.0020.0174.78
4.4.80.0030.0154.76
4.4.70.0000.0184.76
4.4.60.0060.0214.76
4.4.50.0090.0184.77
4.4.40.0030.0284.71
4.4.30.0040.0144.76
4.4.20.0060.0134.84
4.4.10.0060.0234.84
4.4.00.0050.0264.76
4.3.110.0060.0244.67
4.3.100.0020.0254.67
4.3.90.0050.0204.63
4.3.80.0020.0314.59
4.3.70.0030.0224.63
4.3.60.0050.0184.62
4.3.50.0040.0154.63
4.3.40.0030.0304.54
4.3.30.0030.0193.30
4.3.20.0020.0163.28
4.3.10.0010.0173.24
4.3.00.0300.01710.54

preferences:
44.13 ms | 400 KiB | 5 Q