3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Parcel { protected $weight; protected $destinationCountry; public function setWeight($weight) { echo "the weight is" . $weight; $this->weight = $weight; return $this; } public function setCountry($destinationCountry) { echo "country is " . $destinationCountry; $this->destinationCountry = $destinationCountry; return $this; } } $myParcel = new Parcel(); $myParcel->setWeight(5)->setCountry("India"); class Courier { public function calculateShipping(Parcel $parcel) { $rate = $this->getShippingRateForCountry($parcel->destinationCountry); $cost = $rate * $parcel->weight; return $cost; } public function getShippingRateForCountry() { return 1.2; } } //$myCourier = new Courier(); //$myCourier->calculateShipping

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.0140.00718.50
8.3.50.0080.00617.88
8.3.40.0120.00918.69
8.3.30.0140.00019.04
8.3.20.0040.00420.33
8.3.10.0040.00421.90
8.3.00.0040.00419.10
8.2.180.0170.00318.41
8.2.170.0140.00322.96
8.2.160.0030.01322.11
8.2.150.0120.00024.18
8.2.140.0120.00424.66
8.2.130.0000.00726.16
8.2.120.0080.00019.77
8.2.110.0060.00322.03
8.2.100.0090.00317.78
8.2.90.0050.00319.17
8.2.80.0040.00417.97
8.2.70.0000.00817.75
8.2.60.0000.00818.04
8.2.50.0080.00018.07
8.2.40.0040.00419.95
8.2.30.0030.00817.98
8.2.20.0040.00417.74
8.2.10.0040.00418.05
8.2.00.0030.00517.68
8.1.270.0040.00418.96
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0030.00623.72
8.1.230.0070.00418.97
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0040.00417.22
8.1.180.0000.00818.10
8.1.170.0040.00418.52
8.1.160.0000.00721.89
8.1.150.0040.00418.75
8.1.140.0000.00819.18
8.1.130.0000.00717.83
8.1.120.0070.00017.38
8.1.110.0030.00517.25
8.1.100.0040.00417.30
8.1.90.0000.00817.43
8.1.80.0080.00017.36
8.1.70.0070.00017.34
8.1.60.0000.00917.44
8.1.50.0000.00917.41
8.1.40.0040.00417.38
8.1.30.0040.00417.54
8.1.20.0040.00417.65
8.1.10.0000.00717.52
8.1.00.0030.00617.36
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0040.00418.33
8.0.270.0070.00017.17
8.0.260.0060.00317.14
8.0.250.0000.00716.95
8.0.240.0000.00617.05
8.0.230.0000.00717.02
8.0.220.0000.00616.87
8.0.210.0070.00016.80
8.0.200.0030.00316.92
8.0.190.0030.00616.92
8.0.180.0000.00816.90
8.0.170.0040.00416.92
8.0.160.0030.00316.89
8.0.150.0000.00816.71
8.0.140.0050.00516.89
8.0.130.0030.00313.41
8.0.120.0090.00016.89
8.0.110.0040.00416.77
8.0.100.0000.00716.76
8.0.90.0050.00216.73
8.0.80.0000.01516.85
8.0.70.0070.00016.80
8.0.60.0070.00016.63
8.0.50.0040.00416.84
8.0.30.0100.01216.94
8.0.20.0170.00317.40
8.0.10.0080.00016.94
8.0.00.0050.01216.79
7.4.330.0030.00315.03
7.4.320.0060.00016.40
7.4.300.0000.00616.58
7.4.290.0040.00416.40
7.4.280.0070.00016.53
7.4.270.0030.00316.50
7.4.260.0030.00616.61
7.4.250.0040.00416.52
7.4.240.0050.00316.51
7.4.230.0050.00316.68
7.4.220.0080.00916.60
7.4.210.0070.00716.67
7.4.200.0040.00416.41
7.4.160.0070.00716.30
7.4.150.0090.01217.40
7.4.140.0130.00717.86
7.4.130.0080.00816.46
7.4.120.0080.01016.33
7.4.110.0100.00716.39
7.4.100.0140.00316.50
7.4.90.0130.00616.32
7.4.80.0050.01719.39
7.4.70.0090.01216.52
7.4.60.0100.01016.53
7.4.50.0000.00816.53
7.4.40.0080.00816.62
7.4.30.0100.00716.50
7.4.00.0060.00615.02
7.3.330.0030.00313.06
7.3.320.0020.00213.23
7.3.310.0050.00216.34
7.3.300.0020.00516.24
7.3.290.0060.00916.24
7.3.280.0120.00816.25
7.3.270.0120.00617.40
7.3.260.0070.01016.42
7.3.250.0110.00616.33
7.3.240.0120.00616.40
7.3.230.0030.01316.48
7.3.210.0130.00316.51
7.3.200.0040.01519.39
7.3.190.0150.00416.45
7.3.180.0150.00616.21
7.3.170.0060.01216.55
7.3.160.0030.01316.22
7.2.330.0150.00316.80
7.2.320.0060.01216.35
7.2.310.0070.01416.52
7.2.300.0100.00716.46
7.2.290.0130.01016.44
7.2.60.0030.00916.82
7.2.00.0090.00319.48
7.1.200.0080.00415.56
7.1.100.0040.00717.83
7.1.70.0030.00517.09
7.1.60.0090.01319.46
7.1.50.0090.01616.92
7.1.00.0100.07022.43
7.0.200.0080.00816.61
7.0.140.0000.03721.95
7.0.60.0030.04020.03
7.0.50.0130.07717.96
7.0.40.0000.05320.27
7.0.30.0200.08320.21
7.0.20.0330.07020.23
7.0.10.0130.08020.24
7.0.00.0130.05020.05
5.6.280.0070.07021.07
5.6.210.0070.08020.72
5.6.200.0100.04718.24
5.6.190.0070.06320.33
5.6.180.0270.05720.77
5.6.170.0300.04020.56
5.6.160.0030.04320.57
5.6.150.0070.03318.16
5.6.140.0070.05018.28
5.6.130.0100.05018.28
5.6.120.0070.06021.16
5.6.110.0070.07320.98
5.6.100.0100.07021.00
5.6.90.0070.08320.98
5.6.80.0030.07020.41
5.5.350.0000.07020.30
5.5.340.0130.07318.04
5.5.330.0130.04320.23
5.5.320.0300.05720.38
5.5.310.0230.04720.34
5.5.300.0170.04018.02
5.5.290.0070.05017.99
5.5.280.0200.07320.78
5.5.270.0030.05320.75
5.5.260.0070.08020.84
5.5.250.0200.04320.59
5.5.240.3900.04020.30
5.4.450.0230.05719.54
5.4.440.0570.06319.16
5.4.430.0030.06019.51
5.4.420.0200.05019.51
5.4.410.0270.03719.57
5.4.400.0170.06019.10
5.4.390.0230.04718.58
5.4.380.0130.05718.48
5.4.370.0100.06018.77
5.4.360.0200.04718.77
5.4.350.0170.05318.47
5.4.340.0130.05318.75
5.4.320.0070.07018.50
5.4.310.0270.04318.84
5.4.300.0170.05318.75
5.4.290.0170.05018.63
5.4.280.0170.05018.54
5.4.270.0170.05318.68
5.4.260.0170.05318.44
5.4.250.0200.05318.55
5.4.240.0170.06018.84
5.4.230.0170.05318.70
5.4.220.0200.05018.46
5.4.210.0170.05318.46
5.4.200.0130.05316.80
5.4.190.0200.05018.78
5.4.180.0200.05018.71
5.4.170.0230.05318.82
5.4.160.0170.05318.54
5.4.150.0230.04718.45
5.4.140.0130.06316.23
5.4.130.0230.04016.28
5.4.120.0300.05316.30
5.4.110.0170.05716.44
5.4.100.0170.05316.25
5.4.90.0200.04716.24
5.4.80.0130.05316.31
5.4.70.0230.04716.23
5.4.60.0300.04016.18
5.4.50.0270.04316.19
5.4.40.0200.05016.40
5.4.30.0170.05016.29
5.4.20.0130.05316.22
5.4.10.0230.04016.39
5.4.00.0130.05315.67
5.3.290.0130.05714.66
5.3.280.0100.05714.64
5.3.270.0130.05714.67
5.3.260.0170.05314.65
5.3.250.0230.04314.66
5.3.240.0130.05714.83
5.3.230.0130.05714.73
5.3.220.0270.04314.74
5.3.210.0300.04014.76
5.3.200.0200.04714.68
5.3.190.0130.05714.63
5.3.180.0270.05314.79
5.3.170.0100.06314.61
5.3.160.0230.05314.63
5.3.150.0200.04714.63
5.3.140.0200.05314.62
5.3.130.0170.05314.66
5.3.120.0130.05714.54
5.3.110.0170.06014.68
5.3.100.0130.05314.15
5.3.90.0130.05314.06
5.3.80.0170.05014.15
5.3.70.0070.06014.13
5.3.60.0230.04314.04
5.3.50.0230.04714.00
5.3.40.0070.06013.99
5.3.30.0170.05014.03
5.3.20.0270.03713.77
5.3.10.0130.05313.67
5.3.00.0170.05013.78
5.2.170.0130.04311.27
5.2.160.0100.04311.17
5.2.150.0100.04711.14
5.2.140.0270.03711.22
5.2.130.0100.05011.05
5.2.120.0230.03711.09
5.2.110.0130.04311.16
5.2.100.0170.04311.23
5.2.90.0170.04011.32
5.2.80.0100.06011.21
5.2.70.0230.04711.12
5.2.60.0130.05711.04
5.2.50.0170.04011.08
5.2.40.0170.04711.06
5.2.30.0230.04311.02
5.2.20.0170.05010.95
5.2.10.0130.05010.86
5.2.00.0100.05710.75
5.1.60.0200.02710.08
5.1.50.0030.04310.13
5.1.40.0100.03710.02
5.1.30.0130.03310.47
5.1.20.0100.03710.41
5.1.10.0170.03010.22
5.1.00.0100.03710.23
5.0.50.0070.0308.66
5.0.40.0130.0208.63
5.0.30.0100.0478.36
5.0.20.0070.0308.21
5.0.10.0130.0238.29
5.0.00.0230.0308.21
4.4.90.0000.0275.91
4.4.80.0100.0175.86
4.4.70.0100.0175.86
4.4.60.0030.0235.90
4.4.50.0070.0205.91
4.4.40.0030.0405.88
4.4.30.0070.0205.87
4.4.20.0030.0236.08
4.4.10.0070.0205.97
4.4.00.0130.0305.98
4.3.110.0030.0235.84
4.3.100.0000.0275.79
4.3.90.0070.0205.77
4.3.80.0070.0375.86
4.3.70.0070.0235.87
4.3.60.0030.0235.81
4.3.50.0000.0275.79
4.3.40.0000.0405.84
4.3.30.0030.0234.63
4.3.20.0030.0234.61
4.3.10.0030.0234.53
4.3.00.0030.03012.52

preferences:
52.87 ms | 400 KiB | 5 Q