3v4l.org

run code in 300+ PHP versions simultaneously
<?php class GameObject { protected $name; protected $description; public function __construct($name, $description) { $this->name = $name; $this->description = $description; } public function display() { echo "\n Name: " . $this->name; echo "\n Description: " . $this->description; } } class Character extends GameObject { private $url; public function __construct($name, $description, $url) { parent::__construct ($name, $description); $this->url = $url; } public function display() { parent::display (); echo "\n Url: " . $this->url; } } class Obstacle extends GameObject { private $movable; private $hittable; public function __construct($name, $description, $movable, $hittable) { parent::__construct ($name, $description); $this->movable = $movable; $this->hittable = $hittable; } public function display() { parent::display (); echo "\n Movable: " . $this->movable; echo "\n Hittable: " . $this->hittable; } } // Creating object array $objects = array(); $objects['Mario'] = new Character( 'Mario', 'A short, pudgy, plumber who resides in the Mushroom Kingdom.', ' https://upload.wikimedia.org/wikipedia/en/9/99/MarioSMBW.png' ); $objects['Luigi'] = new Character( 'Luigi', 'Younger brother of Mario.', 'https://upload.wikimedia.org/wikipedia/en/f/f1/LuigiNSMBW.png' ); $objects['Bowser'] = new Character( 'Bowser', 'Bowser is the leader and most powerful of the turtle-like Koopa race.', 'https://upload.wikimedia.org/wikipedia/en/e/ec/Bowser_-_New_Super_Mario_Bros_2.png' ); $objects['Coin'] = new Obstacle( 'Coin', 'Coins are added to each level, which reward an extra life.', 'No', 'Yes' ); $objects['Brick'] = new Obstacle( 'Brick', 'Characters cannot get pass through the bricks.', 'No', 'No' ); echo"\nSuperMario: Introduction of Game Objects \n"; $check = 'y'; while ($check == 'y'){ $searchObject = readline("\nEnter the name of the object: \n"); if (isset($objects[$searchObject])) { $objects[$searchObject]->display(); } else { echo "\n Sorry, object not found\n"; } echo "\n"; $check=readline("Do you want to continue? (y/n): "); } ?>

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.0070.00716.75
8.3.50.0100.00722.09
8.3.40.0070.01118.91
8.3.30.0150.00018.89
8.3.20.0040.00419.33
8.3.10.0040.00423.70
8.3.00.0070.00022.39
8.2.180.0190.00316.75
8.2.170.0070.00722.96
8.2.160.0120.00319.47
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00422.08
8.2.120.0080.00026.35
8.2.110.0060.00320.96
8.2.100.0090.00317.67
8.2.90.0030.00619.26
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0000.00818.04
8.2.50.0040.00818.10
8.2.40.0050.00322.28
8.2.30.0030.00519.34
8.2.20.0040.00417.79
8.2.10.0000.00718.18
8.2.00.0090.00017.64
8.1.280.0140.00425.92
8.1.270.0080.00022.14
8.1.260.0000.00928.09
8.1.250.0040.00428.09
8.1.240.0000.00921.42
8.1.230.0080.00417.42
8.1.220.0060.00617.74
8.1.210.0030.00618.77
8.1.200.0000.00817.22
8.1.190.0060.00317.10
8.1.180.0090.00018.10
8.1.170.0030.00518.50
8.1.160.0000.00722.19
8.1.150.0070.00019.04
8.1.140.0000.00719.61
8.1.130.0040.00417.65
8.1.120.0000.00717.48
8.1.110.0040.00417.40
8.1.100.0040.00417.56
8.1.90.0040.00417.40
8.1.80.0030.00517.47
8.1.70.0040.00417.41
8.1.60.0040.00417.66
8.1.50.0040.00417.57
8.1.40.0040.00417.57
8.1.30.0030.00617.63
8.1.20.0050.00217.74
8.1.10.0000.00817.61
8.1.00.0080.00017.62
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0030.00318.50
8.0.270.0020.00717.34
8.0.260.0030.00316.93
8.0.250.0000.00716.89
8.0.240.0030.00617.02
8.0.230.0000.00817.04
8.0.220.0070.00016.96
8.0.210.0000.00716.80
8.0.200.0030.00716.88
8.0.190.0060.00317.02
8.0.180.0000.00816.96
8.0.170.0050.00216.92
8.0.160.0040.00416.86
8.0.150.0000.00716.91
8.0.140.0000.00716.88
8.0.130.0000.00513.34
8.0.120.0050.00316.79
8.0.110.0000.00716.91
8.0.100.0000.00716.95
8.0.90.0070.00016.93
8.0.80.0080.00817.00
8.0.70.0000.00716.88
8.0.60.0000.00716.84
8.0.50.0040.00416.93
8.0.30.0060.01217.02
8.0.20.0080.01217.40
8.0.10.0050.00317.06
8.0.00.0150.00316.55
7.4.330.0000.00515.08
7.4.320.0030.00316.57
7.4.300.0000.00716.65
7.4.290.0030.00316.63
7.4.280.0070.00016.59
7.4.270.0000.00716.65
7.4.260.0070.00016.45
7.4.250.0040.00416.50
7.4.240.0000.00716.45
7.4.230.0000.00716.66
7.4.220.0070.01116.65
7.4.210.0030.01216.42
7.4.200.0000.00716.75
7.4.160.0110.00716.56
7.4.150.0090.01317.40
7.4.140.0070.01017.86
7.4.130.0120.00516.59
7.4.120.0080.01216.63
7.4.110.0090.00916.64
7.4.100.0100.01616.61
7.4.90.0090.01516.38
7.4.80.0130.00619.39
7.4.70.0130.00716.63
7.4.60.0110.01116.56
7.4.50.0070.00716.49
7.4.40.0100.00716.56
7.4.30.0150.00616.48
7.4.00.0030.01015.11
7.3.330.0050.00013.32
7.3.320.0060.00013.34
7.3.310.0000.00916.45
7.3.300.0070.00016.32
7.3.290.0110.00416.52
7.3.280.0070.00916.47
7.3.270.0040.01417.40
7.3.260.0140.00316.45
7.3.250.0120.00716.39
7.3.240.0110.00816.46
7.3.230.0040.01216.42
7.3.210.0030.01416.72
7.3.200.0100.00716.46
7.3.190.0070.01016.47
7.3.180.0150.00316.57
7.3.170.0040.01316.40
7.3.160.0070.01016.38
7.2.330.0090.00916.73
7.2.320.0130.00316.77
7.2.310.0110.01116.72
7.2.300.0070.01116.56
7.2.290.0070.01016.52
7.2.60.0060.00916.73
7.2.00.0060.00619.46
7.1.200.0070.00315.65
7.1.100.0000.01618.09
7.1.70.0040.00417.09
7.1.60.0040.00817.22
7.1.50.0090.01316.89
7.1.00.0130.06722.44
7.0.200.0040.00715.10
7.0.100.0070.05720.04
7.0.90.0070.06719.98
7.0.80.2300.06320.07
7.0.70.0100.06019.99
7.0.60.0100.07020.02
7.0.50.0200.07320.44
7.0.40.0130.06320.34
7.0.30.0100.08720.40
7.0.20.0230.05020.30
7.0.10.0170.05720.33
7.0.00.0230.08020.41
5.6.250.0070.05720.80
5.6.240.0170.05320.84
5.6.230.0200.05720.83
5.6.220.0230.05720.76
5.6.210.0070.06720.69
5.6.200.0100.08321.16
5.6.190.0100.06021.20
5.6.180.0200.07721.18
5.6.170.0100.07321.20
5.6.160.0170.08321.09
5.6.150.0070.07721.13
5.6.140.0100.07321.11
5.6.130.0170.05721.15
5.6.120.0070.06721.14
5.6.110.0100.05721.19
5.6.100.0030.06321.14
5.6.90.0070.08021.03
5.6.80.0070.05720.50
5.6.70.0100.05720.45
5.6.60.0100.05720.48
5.6.50.0100.06020.50
5.6.40.0000.06720.48
5.6.30.0130.05320.47
5.6.20.0270.04020.47
5.6.10.0100.05320.55
5.6.00.0100.05320.39

preferences:
64.01 ms | 401 KiB | 5 Q