3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Shape { public function getArea(); } class Rectangle implements Shape { private $width; private $height; public function setWidth($width) { $this->width = $width; } public function setHeight($height) { $this->height = $height; } public function getWidth() { return $this->width; } public function getHeight() { return $height->height; } public function getArea() { return $this->height * $this->width; } } class Cube extends Rectangle { public function setWidth($width) { parent::setWidth($width); parent::setHeight($width); } public function setHeight($height) { parent::setWidth($width); parent::setHeight($width) } } function setWidthAndReturnArea(Rectangle $rectangle, $width) { $rectangle->setWidth($width); return $this->getArea(); } $width = 2; $height = 2; $cube = new Cube(); $cube->setWidth($width); $cube->setHeight($height); $area = setWidthAndReturnArea($cube, $width = 4); if ($area == $width * $height) { echo '$cube gedraagt zich als een Rectangle'; } else { echo '$cube gedraagt zich niet als een Rectangle'; }

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)
5.4.270.0170.05318.75
5.4.260.0200.05718.93
5.4.250.0030.05718.93
5.4.240.0100.06718.80
5.4.230.0170.05018.75
5.4.220.0100.05718.97
5.4.210.0070.05719.02
5.4.200.0170.04718.76
5.4.190.0030.06718.79
5.4.180.0130.07018.88
5.4.170.0070.06018.93
5.4.160.0130.05019.01
5.4.150.0070.08319.07
5.4.140.0100.05316.50
5.4.130.0130.04316.48
5.4.120.0170.04716.44
5.4.110.0130.05016.52
5.4.100.0000.06016.41
5.4.90.0130.04716.41
5.4.80.0130.06716.51
5.4.70.0070.05016.50
5.4.60.0070.05016.46
5.4.50.0130.06316.61
5.4.40.0100.06716.59
5.4.30.0170.04716.48
5.4.20.0170.05716.52
5.4.10.0030.06016.38
5.4.00.0000.07315.84
5.3.280.0130.05014.77
5.3.270.0130.05314.45
5.3.260.0170.07714.70
5.3.250.0130.07314.78
5.3.240.0100.07014.80
5.3.230.0100.05314.75
5.3.220.0170.05014.67
5.3.210.0100.06314.60
5.3.200.0170.04714.49
5.3.190.0070.05714.57
5.3.180.0130.06714.74
5.3.170.0130.05314.61
5.3.160.0000.06314.71
5.3.150.0100.06014.41
5.3.140.0130.06314.40
5.3.130.0100.06014.65
5.3.120.0100.07014.39
5.3.110.0130.04714.74
5.3.100.0130.06314.02
5.3.90.0100.05314.05
5.3.80.0100.04714.21
5.3.70.0200.04714.20
5.3.60.0170.05014.17
5.3.50.0130.04714.04
5.3.40.0130.06314.03
5.3.30.0070.05314.08
5.3.20.0100.04313.78
5.3.10.0100.05313.66
5.3.00.0130.04313.66
5.2.170.0070.06011.38
5.2.160.0030.04011.25
5.2.150.0070.05711.14
5.2.140.0100.03711.24
5.2.130.0130.05311.20
5.2.120.0070.05711.11
5.2.110.0000.05011.18
5.2.100.0070.05311.19
5.2.90.0070.06011.18
5.2.80.0030.04011.09
5.2.70.0070.06311.28
5.2.60.0100.04311.25
5.2.50.0030.05011.13
5.2.40.0230.03311.00
5.2.30.0170.03711.15
5.2.20.0130.03311.05
5.2.10.0070.04010.84
5.2.00.0070.04310.81
5.1.60.0200.03010.01
5.1.50.0070.0439.96
5.1.40.0100.0409.96
5.1.30.0100.04310.53
5.1.20.0130.03010.59
5.1.10.0130.03710.05
5.1.00.0000.04010.32
5.0.50.0000.0338.61
5.0.40.0070.0308.48
5.0.30.0000.0508.23
5.0.20.0030.0378.18
5.0.10.0070.0378.19
5.0.00.0100.0508.18
4.4.90.0070.0207.20
4.4.80.0070.0237.20
4.4.70.0030.0207.20
4.4.60.0030.0277.20
4.4.50.0030.0337.20
4.4.40.0000.0377.20
4.4.30.0070.0207.20
4.4.20.0070.0307.20
4.4.10.0070.0277.20
4.4.00.0030.0337.20
4.3.110.0070.0177.20
4.3.100.0030.0207.20
4.3.90.0030.0207.20
4.3.80.0030.0407.20
4.3.70.0030.0237.20
4.3.60.0000.0307.20
4.3.50.0070.0207.20
4.3.40.0000.0407.20
4.3.30.0100.0137.20
4.3.20.0030.0207.20
4.3.10.0000.0307.20
4.3.00.0030.0206.71

preferences:
139.06 ms | 1394 KiB | 7 Q