3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Food { public function consume() { } } class AnimalFood extends Food { } abstract class Animal { protected $name; public function __construct(string $name) { $this->name = $name; } public function getName(): string { return $this->name; } abstract public function talk(); public function eat(AnimalFood $food) { $food->consume(); } } class Dog extends Animal { public function speak() { echo "woof"; } /* * 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 "meow"; } } interface Petshop { public function buy(string $name): Animal; } class CatPetshop implements Petshop { public function buy(string $name): Cat { return new Cat($name); } } class DogPetshop implements Petshop { public function buy(string $name): Cat { return new Dog($name); } } $shop = some_func_returning_petshop(); $shop->buy('mavrick')->talk();

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)
7.4.00.0000.01414.79
7.3.120.0090.00514.72
7.3.110.0030.01014.79
7.3.100.0030.01014.50
7.3.90.0070.00714.66
7.3.80.0070.00714.90
7.3.70.0000.01414.35
7.3.60.0030.01214.64
7.3.50.0070.01114.80
7.3.40.0110.00314.73
7.3.30.0160.00614.36
7.3.20.0170.00014.68
7.3.10.0110.00314.74
7.3.00.0070.00714.72
7.2.250.0060.00914.88
7.2.240.0030.01214.56
7.2.230.0080.00814.86
7.2.220.0040.01114.79
7.2.210.0040.01014.71
7.2.200.0110.00314.82
7.2.190.0060.00814.74
7.2.180.0060.00914.97
7.2.170.0060.00914.71
7.1.330.0030.01213.47
7.1.320.0030.01313.88
7.1.310.0040.01113.58
7.1.300.0100.00613.65
7.1.290.0090.00513.73
7.1.280.0060.00913.82
7.1.270.0070.00713.70
7.1.260.0110.00313.79

preferences:
140.7 ms | 993 KiB | 7 Q