3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Food { public function consume() { } } class AnimalFood extends Food { } abstract class Animal { protected string $name; public function __construct(string $name) { $this->name = $name; } abstract public function speak(); public function eat(AnimalFood $food) { $food->consume(); } } class Dog extends Animal { public function speak() { echo $this->name . " barks"; } /* * The dog doesn't care if it's animal food, it'll eat ANY food */ public function eat(Food $food) { $food->consume(); } } class Cat extends Animal { public function speak() { echo $this->name . " meows"; } } 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"); $kitty->speak(); echo "\n"; $doggy = DogShelter::adopt("Mavrick"); $doggy->speak();

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.120.0120.00720.61
8.4.110.0040.00618.65
8.4.100.0110.00818.71
8.4.90.0130.00720.51
8.4.80.0110.00718.91
8.4.70.0090.01217.59
8.4.60.0160.00518.59
8.4.50.0100.00617.81
8.4.40.0140.00719.54
8.4.30.0100.01020.49
8.4.20.0030.00619.67
8.4.10.0040.00419.43
8.3.250.0120.00718.91
8.3.240.0090.01016.80
8.3.230.0110.00716.53
8.3.220.0060.00319.06
8.3.210.0140.00816.91
8.3.200.0070.00316.69
8.3.190.0090.00917.13
8.3.180.0120.00616.49
8.3.170.0070.01116.68
8.3.160.0120.00616.67
8.3.150.0140.00417.06
8.3.140.0090.00918.61
8.3.130.0130.00318.44
8.3.120.0060.00320.75
8.3.110.0040.00420.94
8.3.100.0040.00424.06
8.3.90.0120.00326.77
8.3.80.0090.00019.36
8.3.70.0100.01016.63
8.3.60.0110.00418.27
8.3.50.0130.00423.58
8.3.40.0090.00618.63
8.3.30.0130.00318.67
8.3.20.0050.00221.89
8.3.10.0000.00720.39
8.3.00.0040.00423.65
8.2.290.0110.01016.88
8.2.280.0050.00318.12
8.2.270.0070.00716.53
8.2.260.0080.00018.41
8.2.250.0090.00018.52
8.2.240.0080.00316.93
8.2.230.0060.00322.58
8.2.220.0030.00637.54
8.2.210.0000.00826.77
8.2.200.0030.00618.88
8.2.190.0150.00016.63
8.2.180.0090.00918.42
8.2.170.0110.00722.96
8.2.160.0090.00620.52
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00426.16
8.2.110.0070.00321.06
8.2.100.0000.01218.09
8.2.90.0000.00819.23
8.2.80.0040.00417.97
8.2.70.0000.00917.50
8.2.60.0100.00017.93
8.2.50.0040.00418.07
8.2.40.0040.00418.16
8.2.30.0050.00218.13
8.2.20.0000.00718.13
8.2.10.0000.00819.16
8.2.00.0000.00819.21
8.1.330.0110.00816.18
8.1.320.0090.01016.07
8.1.310.0000.00816.12
8.1.300.0030.00520.10
8.1.290.0030.00630.84
8.1.280.0110.00425.92
8.1.270.0050.00220.73
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0050.00524.02
8.1.230.0040.00717.83
8.1.220.0000.00817.79
8.1.210.0000.00918.77
8.1.200.0050.00517.35
8.1.190.0000.00817.35
8.1.180.0050.00318.10
8.1.170.0040.00418.46
8.1.160.0030.00520.59
8.1.150.0000.00718.80
8.1.140.0040.00422.10
8.1.130.0000.00720.15
8.1.120.0040.00417.37
8.1.110.0060.00317.35
8.1.100.0000.00817.44
8.1.90.0040.00317.35
8.1.80.0070.00017.39
8.1.70.0030.00517.39
8.1.60.0080.00017.48
8.1.50.0050.00317.50
8.1.40.0100.00017.41
8.1.30.0000.00817.68
8.1.20.0040.00417.55
8.1.10.0080.00017.48
8.1.00.0040.00417.55
8.0.300.0040.00418.77
8.0.290.0050.00216.75
8.0.280.0070.00018.34
8.0.270.0040.00418.08
8.0.260.0030.00320.08
8.0.250.0070.00016.95
8.0.240.0030.00616.83
8.0.230.0070.00016.94
8.0.220.0040.00316.93
8.0.210.0000.00716.88
8.0.200.0050.00316.94
8.0.190.0040.00417.00
8.0.180.0040.00416.92
8.0.170.0030.00516.96
8.0.160.0040.00416.87
8.0.150.0040.00416.80
8.0.140.0040.00316.87
8.0.130.0030.00313.37
8.0.120.0040.00416.79
8.0.110.0080.00016.79
8.0.100.0030.00616.77
8.0.90.0000.00916.93
8.0.80.0060.01216.88
8.0.70.0040.00416.92
8.0.60.0040.00416.79
8.0.50.0000.00716.76
8.0.30.0030.01416.77
8.0.20.0100.00717.09
8.0.10.0040.00417.01
8.0.00.0140.00316.92
7.4.330.0050.00015.55
7.4.320.0000.00616.59
7.4.300.0000.00616.52
7.4.290.0070.00016.64
7.4.280.0040.00416.55
7.4.270.0000.00716.54
7.4.260.0000.00513.29
7.4.250.0050.00316.56
7.4.240.0020.00516.58
7.4.230.0050.00316.63
7.4.220.0030.00316.58
7.4.210.0070.00916.49
7.4.200.0040.00416.65
7.4.140.0070.01017.86
7.4.130.0030.01416.54
7.4.120.0040.02116.61
7.4.110.0070.01016.40
7.4.100.0090.01016.45
7.4.90.0080.00816.42
7.4.80.0130.00419.39
7.4.70.0180.00416.48
7.4.60.0030.01516.42
7.4.50.0030.01216.40
7.4.40.0100.00716.61
7.4.00.0070.00714.68
7.3.330.0040.00416.14
7.3.320.0000.00513.22
7.3.310.0000.00616.23
7.3.300.0000.00716.19
7.3.290.0080.00916.14
7.3.280.0090.00916.18
7.3.260.0100.00716.19
7.3.240.0070.01116.24
7.3.230.0140.00416.39
7.3.210.0070.01416.27
7.3.200.0110.01116.44
7.3.190.0110.01116.33
7.3.180.0120.00416.25
7.3.170.0070.01016.25
7.3.160.0030.01216.43
7.3.120.0100.00314.44
7.3.110.0060.00914.70
7.3.100.0040.01114.61
7.3.90.0090.00914.59
7.3.80.0090.00914.55
7.3.70.0070.00714.27
7.3.60.0070.00714.52
7.3.50.0060.01014.57
7.3.40.0030.01414.55
7.3.30.0070.00714.38
7.3.20.0080.01114.33
7.3.10.0130.00314.67
7.3.00.0070.00714.73
7.2.330.0110.01116.54
7.2.320.0060.01216.45
7.2.310.0100.00616.46
7.2.300.0090.01216.12
7.2.290.0150.00416.20
7.2.250.0030.01614.92
7.2.240.0120.00314.77
7.2.230.0110.00414.97
7.2.220.0100.00514.73
7.2.210.0090.00714.42
7.2.200.0150.00014.72
7.2.190.0000.01414.27
7.2.180.0080.00614.82
7.2.170.0060.01414.71
7.1.330.0130.01013.70
7.1.320.0060.00913.68
7.1.310.0090.00613.59
7.1.300.0070.00713.46
7.1.290.0090.00613.44
7.1.280.0110.00813.59
7.1.270.0030.01013.57
7.1.260.0080.00513.58

preferences:
567.51 ms | 403 KiB | 5 Q