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." nom noms ".get_class($food); } } class Cat extends Animal {} class Dog extends Animal { // The dog doesn't care if it's animal food, it'll eat ANY food public function eat(Food $food) { echo $this->name . " nom noms " . get_class($food); } } interface AnimalShelter { public static function adopt(string $name): Animal; } class CatShelter implements AnimalShelter { public static function adopt(string $name): Cat { return new Cat($name); } } class DogShelter implements AnimalShelter { public static function adopt(string $name): Dog { return new Dog($name); } } $kitty = CatShelter::adopt("Ricky"); $catFood = new AnimalFood(); $kitty->eat($catFood); echo "\n"; $doggy = DogShelter::adopt("Mavrick"); $bananaPeel = new Food(); $doggy->eat($bananaPeel); echo "\n"; $kitty->eat($bananaPeel);

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.0120.00618.68
8.3.50.0170.00016.41
8.3.40.0090.00618.84
8.3.30.0110.00419.02
8.3.20.0000.00921.86
8.3.10.0050.00320.34
8.3.00.0050.00323.52
8.2.180.0070.00716.61
8.2.170.0110.00422.96
8.2.160.0100.00320.35
8.2.150.0050.00524.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0050.00326.16
8.2.110.0030.00620.43
8.2.100.0120.00017.78
8.2.90.0050.00317.75
8.2.80.0000.00918.91
8.2.70.0030.00617.75
8.2.60.0000.00817.61
8.2.50.0040.00417.98
8.2.40.0080.00019.94
8.2.30.0070.00017.95
8.2.20.0060.00317.93
8.2.10.0000.00819.25
8.2.00.0000.00719.31
8.1.280.0140.00725.92
8.1.270.0000.00820.88
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00623.77
8.1.230.0030.00919.05
8.1.220.0080.00017.74
8.1.210.0080.00018.77
8.1.200.0030.00517.48
8.1.190.0040.00417.35
8.1.180.0030.00518.10
8.1.170.0040.00417.62
8.1.160.0080.00018.91
8.1.150.0000.00718.77
8.1.140.0000.00722.07
8.1.130.0020.00520.15
8.1.120.0030.00317.45
8.1.110.0000.00717.34
8.1.100.0040.00417.46
8.1.90.0070.00317.47
8.1.80.0080.00017.46
8.1.70.0030.00517.34
8.1.60.0040.00417.61
8.1.50.0000.00917.47
8.1.40.0030.00517.41
8.1.30.0000.00917.59
8.1.20.0050.00517.68
8.1.10.0060.00317.45
8.1.00.0080.00017.43
8.0.300.0030.00619.55
8.0.290.0000.00916.75
8.0.280.0000.00818.46
8.0.270.0030.00318.04
8.0.260.0060.00020.01
8.0.250.0040.00416.98
8.0.240.0070.00317.04
8.0.230.0030.00617.02
8.0.220.0070.00016.98
8.0.210.0040.00416.96
8.0.200.0030.00316.94
8.0.190.0080.00016.94
8.0.180.0040.00416.86
8.0.170.0030.00616.86
8.0.160.0040.00416.94
8.0.150.0030.00416.85
8.0.140.0030.00316.92
8.0.130.0000.00513.42
8.0.120.0040.00416.83
8.0.110.0080.00016.75
8.0.100.0040.00416.84
8.0.90.0030.00616.96
8.0.80.0100.00916.86
8.0.70.0040.00416.85
8.0.60.0050.00216.86
8.0.50.0040.00416.78
8.0.30.0030.01517.33
8.0.20.0100.00717.07
8.0.10.0070.00017.03
8.0.00.0090.00917.04
7.4.330.0050.00015.55
7.4.320.0000.00616.53
7.4.300.0040.00416.52
7.4.290.0000.00716.61
7.4.280.0080.00016.50
7.4.270.0000.00716.54
7.4.260.0050.00013.23
7.4.250.0000.00816.46
7.4.240.0020.00516.53
7.4.230.0030.00316.48
7.4.220.0040.00316.42
7.4.210.0060.01116.60
7.4.200.0000.00716.26
7.4.130.0150.00316.42
7.4.120.0100.01616.44
7.4.110.0190.01116.54
7.4.100.0090.01316.55
7.4.90.0140.00316.53
7.4.80.0070.01019.39
7.4.70.0100.00716.75
7.4.60.0060.01016.54
7.4.50.0070.00716.51
7.4.40.0140.00316.66
7.4.00.0070.00714.75
7.3.330.0000.00716.21
7.3.320.0020.00213.10
7.3.310.0000.00716.21
7.3.300.0000.00716.21
7.3.290.0110.00316.17
7.3.280.0070.01016.11
7.3.260.0060.01116.20
7.3.240.0080.00916.14
7.3.230.0080.00816.17
7.3.210.0090.00916.22
7.3.200.0060.01316.21
7.3.190.0110.00716.05
7.3.180.0150.00016.39
7.3.170.0100.00616.23
7.3.160.0120.00316.30
7.3.120.0090.00614.80
7.3.110.0090.00614.54
7.3.100.0070.00714.64
7.3.90.0030.01014.58
7.3.80.0040.01114.59
7.3.70.0090.00414.67
7.3.60.0130.00014.77
7.3.50.0040.01114.69
7.3.40.0030.01114.29
7.3.30.0080.00514.55
7.3.20.0000.01314.53
7.3.10.0110.00414.78
7.3.00.0150.00314.70
7.2.330.0160.00316.27
7.2.320.0030.01316.21
7.2.310.0040.01216.56
7.2.300.0090.00916.24
7.2.290.0100.00616.23
7.2.250.0060.01314.52
7.2.240.0130.00014.62
7.2.230.0000.01414.57
7.2.220.0120.00814.92
7.2.210.0000.01414.70
7.2.200.0030.01114.68
7.2.190.0090.00614.86
7.2.180.0040.01014.37
7.2.170.0030.01014.90
7.2.160.0070.00714.86
7.2.150.0110.00314.78
7.2.140.0050.00914.72
7.2.130.0110.00814.77
7.2.120.0070.00814.95
7.2.110.0120.00314.91
7.2.100.0090.01214.91
7.2.90.0120.00614.94
7.2.80.0000.01514.89
7.2.70.0100.01315.06
7.2.60.0030.01214.82
7.2.50.0110.00415.12
7.2.40.0120.00314.91
7.2.30.0080.00514.55
7.2.20.0090.00614.97
7.2.10.0090.00614.92
7.2.00.0120.00314.66

preferences:
45.93 ms | 400 KiB | 5 Q