3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Shipping { private $company; function __construct(){ $this->company = ""; } function setStrategy($company){ $this->company = $company; } function calculate (Package $package){ return $this->company->calculate($package); } } interface Company { public function calculate(); } class UPS implements Company{ public function calculate(Package $package){ return 45 * $package->weight; } } class USPS implements Company{ public function calculate(Package $package){ return 30 * $package->weight; } } class FedEx implements Company { public function calculate(Package $package){ return 60 * $package->weight; } } class Package { public $weight; function __construct($weight){ $this->weight = $weight; } } $package = new Package(30); $shipping = new Shipping(); $shiping->setStrategy(new UPS()); echo $shipping->calculate($package);

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.0070.01418.68
8.3.50.0040.01118.02
8.3.40.0110.00718.67
8.3.30.0100.00718.41
8.3.20.0050.00319.02
8.3.10.0080.00021.76
8.3.00.0070.00023.70
8.2.180.0040.01118.16
8.2.170.0000.01522.96
8.2.160.0040.01819.02
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0070.00017.97
8.2.120.0040.00426.35
8.2.110.0070.01120.99
8.2.100.0120.00017.97
8.2.90.0030.00618.16
8.2.80.0040.00417.97
8.2.70.0050.00317.90
8.2.60.0000.01017.97
8.2.50.0040.00418.10
8.2.40.0000.00719.18
8.2.30.0020.00519.10
8.2.20.0050.00517.98
8.2.10.0000.00819.44
8.2.00.0000.00919.24
8.1.280.0030.01725.92
8.1.270.0000.00822.05
8.1.260.0000.01426.35
8.1.250.0050.00328.09
8.1.240.0060.00321.98
8.1.230.0030.01022.77
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0100.00017.13
8.1.190.0040.00417.22
8.1.180.0040.00418.10
8.1.170.0000.00918.94
8.1.160.0050.00318.77
8.1.150.0000.00718.75
8.1.140.0040.00419.31
8.1.130.0040.00418.87
8.1.120.0000.00717.30
8.1.110.0070.00317.30
8.1.100.0040.00417.34
8.1.90.0050.00317.36
8.1.80.0050.00217.45
8.1.70.0030.00317.43
8.1.60.0120.00017.59
8.1.50.0030.00617.51
8.1.40.0000.00817.48
8.1.30.0030.00517.53
8.1.20.0000.00717.64
8.1.10.0040.00417.44
8.1.00.0060.00317.22
8.0.300.0020.00519.63
8.0.290.0040.00416.75
8.0.280.0030.00318.39
8.0.270.0040.00417.20
8.0.260.0030.00317.11
8.0.250.0070.00016.86
8.0.240.0000.00716.93
8.0.230.0030.00316.99
8.0.220.0040.00416.89
8.0.210.0050.00316.79
8.0.200.0000.00816.98
8.0.190.0000.00716.96
8.0.180.0080.00016.96
8.0.170.0040.00416.93
8.0.160.0050.00316.94
8.0.150.0080.00016.82
8.0.140.0040.00416.88
8.0.130.0000.00613.36
8.0.120.0070.00316.75
8.0.110.0080.00016.79
8.0.100.0000.00716.76
8.0.90.0040.00416.78
8.0.80.0110.00916.89
8.0.70.0040.00416.68
8.0.60.0080.00016.70
8.0.50.0030.00316.79
8.0.30.0100.00717.06
8.0.20.0120.00717.40
8.0.10.0050.00216.99
8.0.00.0080.01216.59
7.4.330.0050.00015.55
7.4.320.0030.00316.43
7.4.300.0030.00316.45
7.4.290.0040.00416.46
7.4.280.0040.00416.46
7.4.270.0000.00716.55
7.4.260.0070.00016.43
7.4.250.0070.00016.31
7.4.240.0030.00316.42
7.4.230.0000.00816.38
7.4.220.0040.00416.45
7.4.210.0050.01116.50
7.4.200.0030.00316.42
7.4.160.0100.00916.49
7.4.140.0100.01417.86
7.4.130.0110.00716.43
7.4.120.0110.00916.43
7.4.110.0100.00716.52
7.4.100.0140.00716.15
7.4.90.0060.01216.46
7.4.80.0060.01019.39
7.4.70.0190.00316.54
7.4.60.0040.01316.40
7.4.50.0100.00716.38
7.4.40.0060.01616.44
7.4.00.0090.00614.87
7.3.330.0060.00313.04
7.3.320.0000.00513.01
7.3.310.0000.00716.10
7.3.300.0030.00316.29
7.3.290.0070.00016.11
7.3.280.0110.00316.17
7.3.260.0120.00816.35
7.3.240.0120.00616.43
7.3.230.0080.00816.36
7.3.210.0140.00316.46
7.3.200.0090.00916.45
7.3.190.0090.00616.42
7.3.180.0090.00616.24
7.3.170.0170.00016.56
7.3.160.0100.00716.39
7.3.10.0070.00316.30
7.3.00.0030.00716.53
7.2.330.0110.00716.63
7.2.320.0000.01816.28
7.2.310.0090.00916.72
7.2.300.0090.01216.57
7.2.290.0110.00616.46
7.2.130.0040.00716.64
7.2.120.0140.00016.66
7.2.110.0070.01016.64
7.2.100.0060.00916.64
7.2.90.0030.00516.61
7.2.80.0070.00416.63
7.2.70.0140.00715.77
7.2.60.0090.00715.78
7.2.50.0090.00615.63
7.2.40.0130.00715.77
7.2.30.0540.00315.66
7.2.20.0080.01215.78
7.2.10.0100.00615.63
7.2.00.0100.01115.88
7.1.250.0060.00915.39
7.1.200.0000.01215.54
7.1.170.0170.00313.71
7.1.160.0170.01013.68
7.1.150.0170.00313.81
7.1.140.0300.00613.86
7.1.130.0140.00713.89
7.1.120.0100.01013.58
7.1.110.0210.00813.51
7.1.100.0210.00913.89
7.1.90.0220.00613.71
7.1.80.0120.01513.86
7.1.70.0270.00314.04
7.1.60.0410.01731.54
7.1.50.0470.01031.64
7.1.40.0310.00931.66
7.1.30.0280.01231.62
7.1.20.0330.00731.91
7.1.10.0150.00613.67
7.1.00.0090.01313.77

preferences:
56.18 ms | 400 KiB | 5 Q