3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Food {} class AnimalFood extends Food {} abstract class Animal { protected string $name; public function __construct(string $name) { $this->name = $name; } public function eat(AnimalFood $food) { echo $this->name . " eats " . get_class($food); } } class Dog extends Animal { public function eat(Food $food) { echo $this->name . " eats " . get_class($food); } } class Cat extends Animal { public function eat(Food $food) { echo $this->name . " eats " . get_class($food); } } interface AnimalShelter { public function adopt(string $name): Animal; } class CatShelter implements AnimalShelter { public function adopt(string $name): Cat // instead of returning class type Animal, it can return class type Cat { return new Cat($name); } } class DogShelter implements AnimalShelter { public function adopt(string $name): Dog // instead of returning class type Animal, it can return class type Dog { return new Dog($name); } } $kitty = (new CatShelter)->adopt("Ricky"); $catFood = new AnimalFood(); $kitty->eat($catFood); echo "\n"; $doggy = (new DogShelter)->adopt("Mavrick"); $banana = new Food(); $doggy->eat($banana);

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.00416.38
8.3.50.0130.00718.35
8.3.40.0040.01118.97
8.3.30.0030.01019.29
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0070.00026.16
8.2.180.0140.00725.92
8.2.170.0070.00722.96
8.2.160.0130.00022.96
8.2.150.0120.00325.66
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0050.00326.35
8.2.110.0050.00521.98
8.2.100.0040.00717.79
8.2.90.0000.00818.34
8.2.80.0050.00220.45
8.2.70.0030.00617.75
8.2.60.0080.00017.50
8.2.50.0050.00318.05
8.2.40.0040.00419.78
8.2.30.0000.00818.13
8.2.20.0040.00417.96
8.2.10.0040.00419.28
8.2.00.0040.00419.12
8.1.280.0130.00725.92
8.1.270.0000.00823.99
8.1.260.0040.00428.09
8.1.250.0080.00028.09
8.1.240.0060.00323.83
8.1.230.0080.00420.97
8.1.220.0000.00817.79
8.1.210.0030.00618.77
8.1.200.0070.00317.35
8.1.190.0050.00317.35
8.1.180.0060.00318.10
8.1.170.0030.00618.94
8.1.160.0040.00418.88
8.1.150.0080.00018.90
8.1.140.0070.00018.82
8.1.130.0000.00720.19
8.1.120.0000.00717.34
8.1.110.0050.00317.35
8.1.100.0050.00317.31
8.1.90.0050.00217.37
8.1.80.0040.00417.32
8.1.70.0030.00517.44
8.1.60.0080.00017.48
8.1.50.0050.00217.45
8.1.40.0050.00217.54
8.1.30.0060.00317.66
8.1.20.0000.00817.55
8.1.10.0000.00817.59
8.1.00.0060.00617.49
8.0.300.0050.00220.16
8.0.290.0050.00316.88
8.0.280.0090.00018.39
8.0.270.0000.00818.16
8.0.260.0080.00020.23
8.0.250.0000.00716.92
8.0.240.0000.00816.86
8.0.230.0080.00017.04
8.0.220.0030.00316.86
8.0.210.0030.00316.85
8.0.200.0070.00017.06
8.0.190.0050.00316.95
8.0.180.0060.00317.00
8.0.170.0040.00416.87
8.0.160.0000.00716.98
8.0.150.0000.00716.92
8.0.140.0000.00816.92
8.0.130.0030.00313.44
8.0.120.0000.00816.93
8.0.110.0040.00416.83
8.0.100.0000.00716.96
8.0.90.0030.00616.87
8.0.80.0140.00516.96
8.0.70.0030.00616.82
8.0.60.0000.00717.00
8.0.50.0000.00716.82
8.0.30.0030.01317.04
8.0.20.0100.01716.93
8.0.10.0050.00317.06
8.0.00.0110.00816.47
7.4.330.0000.00515.55
7.4.320.0070.00016.37
7.4.300.0000.00616.50
7.4.290.0000.00816.52
7.4.280.0040.00416.59
7.4.270.0050.00316.63
7.4.260.0050.00013.34
7.4.250.0030.00516.57
7.4.240.0020.00516.53
7.4.230.0000.00716.47
7.4.220.0000.00716.62
7.4.210.0080.00716.52
7.4.200.0030.00316.27
7.4.130.0080.01116.47
7.4.120.0120.00616.36
7.4.110.0060.01016.46
7.4.100.0170.00016.48
7.4.90.0130.00716.47
7.4.80.0110.00519.39
7.4.70.0110.00716.70
7.4.60.0090.00916.38
7.4.50.0030.01416.66
7.4.40.0080.00816.44
7.4.30.0040.01316.45
7.4.20.0080.00816.54
7.4.10.0050.01116.63
7.4.00.0000.01816.53
7.3.330.0030.00316.15
7.3.320.0030.00213.21
7.3.310.0040.00416.24
7.3.300.0030.00316.17
7.3.290.0140.00516.14
7.3.280.0090.00616.13
7.3.260.0040.01516.20
7.3.240.0100.01016.29
7.3.230.0100.00616.21
7.3.210.0130.00316.40
7.3.200.0060.00916.36
7.3.190.0110.01116.41
7.3.180.0100.00616.19
7.3.170.0000.01716.15
7.3.160.0090.00616.30
7.3.150.0130.00316.39
7.3.140.0030.01216.18
7.3.130.0080.00916.22
7.3.120.0090.00616.15
7.3.110.0050.01116.09
7.3.100.0080.00816.39
7.3.90.0120.00316.09
7.3.80.0120.00616.18
7.3.70.0190.00016.26
7.3.60.0140.00316.06
7.3.50.0090.00916.09
7.3.40.0120.00616.14
7.3.30.0000.01616.20
7.3.20.0080.00916.32
7.3.10.0080.00816.21
7.3.00.0090.00616.28
7.2.330.0090.00916.55
7.2.320.0190.00416.38
7.2.310.0060.01016.47
7.2.300.0070.01016.55
7.2.290.0040.01316.50
7.2.280.0080.00816.41
7.2.270.0130.00316.19
7.2.260.0090.00616.34
7.2.250.0080.00816.54
7.2.240.0030.01316.16
7.2.230.0050.01116.23
7.2.220.0050.01116.09
7.2.210.0150.00416.30
7.2.200.0030.01416.13
7.2.190.0070.01016.26
7.2.180.0100.00716.33
7.2.170.0020.01516.26
7.2.160.0110.00516.23
7.2.150.0100.00616.45
7.2.140.0070.01016.36
7.2.130.0130.00316.32
7.2.120.0110.00616.43
7.2.110.0150.00616.32
7.2.100.0080.00816.32
7.2.90.0060.01116.38
7.2.80.0100.00716.43
7.2.70.0100.00716.10
7.2.60.0110.00616.52
7.2.50.0080.01116.45
7.2.40.0160.00316.39
7.2.30.0070.01016.39
7.2.20.0040.01216.35
7.2.10.0100.00716.53
7.2.00.0030.01316.42

preferences:
75.33 ms | 401 KiB | 5 Q