3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Vehicle { public function setSpeedLimit(Float $limit) : Car; public function setManufacturer(String $manufacturer) : MethodOfTransport; } interface NonVehicle { public function addSaddle() : Bicycle; public function setManufacturer(String $manufacturer) : MethodOfTransport; } abstract class MethodOfTransport { public function setManufacturer(String $manufacturer) : MethodOfTransport { return $this; } } class Bicycle extends MethodOfTransport implements NonVehicle { public function addSaddle() : Bicycle { return $this; } } class Car extends MethodOfTransport implements Vehicle { public function setSpeedLimit(Float $limit) : Car { return $this; } } $b = (new Bicycle())->setManufacturer( 'Foo' )->addSaddle(); $c = (new Car())->setManufacturer( 'Bar' )->setSpeedLimit( 140 ); interface VehicleServiceInterface { public function create(MethodOfTransport $t) : Void; } class VehicleService implements VehicleServiceInterface { public function create(MethodOfTransport $t) : Void { if (!$t instanceof Vehicle) throw new Exception( 'Cannot create a Vehicle on a NonVehicle instance.' ); echo 'Created'; } } (new VehicleService())->create( $c ); // Works (new VehicleService())->create( $b ); // Throws Exception

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.4.10.0100.01021.36
8.3.140.0040.00416.63
8.3.130.0040.00418.41
8.3.120.0060.01320.70
8.3.110.0060.00316.57
8.3.100.0060.00318.30
8.3.90.0040.01116.52
8.3.80.0060.00619.36
8.3.70.0090.00618.43
8.3.60.0140.00716.88
8.3.50.0110.01224.41
8.3.40.0220.00018.84
8.3.30.0130.00718.61
8.3.20.0150.00424.18
8.3.10.0060.00324.66
8.3.00.0070.00026.16
8.2.260.0040.00418.87
8.2.250.0000.00818.42
8.2.240.0060.00317.40
8.2.230.0060.00320.94
8.2.220.0030.00624.06
8.2.210.0040.00426.77
8.2.200.0090.00316.63
8.2.190.0000.01416.63
8.2.180.0090.01325.92
8.2.170.0060.00919.04
8.2.160.0100.01022.96
8.2.150.0000.00825.66
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00421.02
8.2.110.0100.00020.98
8.2.100.0040.00817.84
8.2.90.0030.00519.21
8.2.80.0000.00818.04
8.2.70.0060.00317.63
8.2.60.0000.00818.05
8.2.50.0040.00418.07
8.2.40.0040.00419.88
8.2.30.0040.00417.95
8.2.20.0000.00818.07
8.2.10.0040.00419.25
8.2.00.0040.00719.16
8.1.310.0120.00818.51
8.1.300.0110.00420.14
8.1.290.0050.00518.88
8.1.280.0100.01025.92
8.1.270.0030.00523.99
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0040.00422.65
8.1.230.0070.00417.70
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0000.00818.47
8.1.160.0040.00418.89
8.1.150.0040.00418.85
8.1.140.0000.00920.66
8.1.130.0000.00717.41
8.1.120.0050.00517.39
8.1.110.0040.00417.46
8.1.100.0040.00417.37
8.1.90.0000.00717.39
8.1.80.0040.00817.50
8.1.70.0080.00017.46
8.1.60.0050.00317.61
8.1.50.0090.00017.54
8.1.40.0040.00417.42
8.1.30.0030.00517.69
8.1.20.0060.00317.52
8.1.10.0030.00517.53
8.1.00.0040.00417.59
8.0.300.0000.00718.77
8.0.290.0050.00216.75
8.0.280.0040.00418.47
8.0.270.0040.00418.13
8.0.260.0040.00416.83
8.0.250.0040.00417.04
8.0.240.0000.00617.09
8.0.230.0030.00316.99
8.0.220.0040.00416.94
8.0.210.0000.00717.00
8.0.200.0030.00317.02
8.0.190.0030.00616.92
8.0.180.0050.00217.01
8.0.170.0090.00016.98
8.0.160.0070.00016.86
8.0.150.0000.00716.82
8.0.140.0040.00416.85
8.0.130.0050.00013.46
8.0.120.0000.00716.92
8.0.110.0000.00716.82
8.0.100.0000.00716.80
8.0.90.0040.00417.03
8.0.80.0050.01016.98
8.0.70.0040.00417.03
8.0.60.0000.00816.78
8.0.50.0050.00316.82
8.0.30.0090.00917.36
8.0.20.0130.00817.11
8.0.10.0050.00217.01
8.0.00.0160.00316.82
7.4.330.0050.00015.55
7.4.320.0000.00616.66
7.4.300.0030.00316.46
7.4.290.0050.00316.55
7.4.280.0000.00716.50
7.4.270.0070.00016.61
7.4.260.0030.00313.25
7.4.250.0030.00316.41
7.4.240.0040.00416.59
7.4.230.0040.00416.52
7.4.220.0020.00516.61
7.4.210.0090.00616.65
7.4.200.0000.00716.71
7.4.130.0050.01616.63
7.4.120.0150.00916.69
7.4.110.0110.00716.56
7.4.100.0090.01616.46
7.4.90.0060.01016.62
7.4.80.0130.00316.55
7.4.70.0080.00816.59
7.4.60.0090.00816.57
7.4.50.0100.00616.60
7.4.40.0130.00316.45
7.4.30.0100.00716.41
7.4.20.0160.00016.43
7.4.10.0100.00716.39
7.4.00.0040.01216.55
7.3.330.0050.00216.26
7.3.320.0030.00313.23
7.3.310.0070.00016.27
7.3.300.0070.00016.31
7.3.290.0090.00716.42
7.3.260.0120.01216.43
7.3.230.0120.01116.60
7.3.210.0170.00316.73
7.3.200.0100.00716.46
7.3.190.0060.00916.45
7.3.180.0130.00316.58
7.3.170.0090.00616.56
7.3.160.0070.01116.43
7.3.150.0060.00916.45
7.3.140.0110.00416.45
7.3.130.0100.00516.41
7.3.120.0060.00916.44
7.3.110.0100.01016.41
7.3.100.0090.00616.23
7.3.90.0180.00316.52
7.3.80.0060.00916.48
7.3.70.0040.01316.24
7.3.60.0040.01416.55
7.3.50.0090.00616.50
7.3.40.0100.00616.34
7.3.30.0090.00616.47
7.3.20.0030.01316.53
7.3.10.0090.00916.34
7.3.00.0090.00916.51
7.2.330.0090.00916.78
7.2.320.0110.01116.37
7.2.310.0070.01016.55
7.2.300.0060.01016.75
7.2.290.0060.00916.66
7.2.280.0060.01116.64
7.2.270.0070.01016.75
7.2.260.0160.00016.65
7.2.250.0130.00316.73
7.2.240.0060.01116.53
7.2.230.0070.01016.78
7.2.220.0070.01016.47
7.2.210.0070.01016.44
7.2.200.0070.01116.76
7.2.190.0090.00916.61
7.2.180.0120.00416.69
7.2.170.0100.00716.68
7.2.160.0100.00716.63
7.2.150.0120.00616.62
7.2.140.0060.01216.71
7.2.130.0100.00716.75
7.2.120.0030.01316.80
7.2.110.0090.00816.71
7.2.100.0030.01316.59
7.2.90.0110.00616.73
7.2.80.0090.00916.61
7.2.70.0060.01116.81
7.2.60.0300.00016.66
7.2.50.0030.01316.76
7.2.40.0060.01216.67
7.2.30.0070.01116.71
7.2.20.0100.00716.70
7.2.10.0160.00016.51
7.2.00.0080.00816.54

preferences:
68.43 ms | 403 KiB | 5 Q