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($height); parent::setHeight($height); } } function setWidthAndReturnArea(Rectangle $rectangle, $width) { $rectangle->setWidth($width); return $rectangle->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)
8.3.60.0160.00318.39
8.3.50.0120.01022.07
8.3.40.0170.00318.79
8.3.30.0100.00319.27
8.3.20.0000.00720.34
8.3.10.0000.00821.92
8.3.00.0080.00022.34
8.2.180.0090.00916.75
8.2.170.0110.00722.96
8.2.160.0110.00722.20
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00417.63
8.2.110.0030.00621.88
8.2.100.0080.00419.51
8.2.90.0000.00919.26
8.2.80.0050.00317.97
8.2.70.0030.00617.75
8.2.60.0000.00817.80
8.2.50.0050.00318.07
8.2.40.0080.00018.09
8.2.30.0030.00518.18
8.2.20.0060.00617.66
8.2.10.0050.00319.46
8.2.00.0040.00417.69
8.1.280.0140.00625.92
8.1.270.0080.00022.11
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0060.00323.89
8.1.230.0110.00019.23
8.1.220.0060.00317.76
8.1.210.0080.00018.77
8.1.200.0030.00617.48
8.1.190.0000.00817.43
8.1.180.0000.00818.10
8.1.170.0050.00318.71
8.1.160.0040.00422.07
8.1.150.0050.00218.57
8.1.140.0060.00317.33
8.1.130.0020.00517.88
8.1.120.0040.00417.38
8.1.110.0040.00417.52
8.1.100.0020.00517.44
8.1.90.0000.00717.46
8.1.80.0070.00017.37
8.1.70.0000.00717.51
8.1.60.0030.00617.60
8.1.50.0070.00017.45
8.1.40.0070.00017.43
8.1.30.0000.00817.64
8.1.20.0070.00317.69
8.1.10.0060.00317.52
8.1.00.0050.00317.38
8.0.300.0040.00418.77
8.0.290.0000.00817.30
8.0.280.0030.00318.33
8.0.270.0040.00417.27
8.0.260.0030.00316.88
8.0.250.0070.00017.02
8.0.240.0070.00016.90
8.0.230.0030.00317.07
8.0.220.0000.00716.98
8.0.210.0000.00716.91
8.0.200.0000.00717.04
8.0.190.0060.00317.05
8.0.180.0060.00317.02
8.0.170.0040.00416.99
8.0.160.0000.00717.02
8.0.150.0000.00816.87
8.0.140.0000.00716.95
8.0.130.0030.00313.43
8.0.120.0040.00416.81
8.0.110.0020.00517.00
8.0.100.0070.00016.96
8.0.90.0040.00416.98
8.0.80.0060.00917.03
8.0.70.0040.00416.85
8.0.60.0040.00416.93
8.0.50.0070.00016.92
8.0.30.0140.00816.86
8.0.20.0110.01017.41
8.0.10.0000.00716.89
8.0.00.0090.00916.76
7.4.330.0020.00215.14
7.4.320.0060.00016.51
7.4.300.0030.00316.52
7.4.290.0000.00816.52
7.4.280.0040.00416.59
7.4.270.0070.00016.43
7.4.260.0030.00316.61
7.4.250.0080.00016.47
7.4.240.0050.00216.46
7.4.230.0000.00716.68
7.4.220.0100.00716.47
7.4.210.0080.00716.56
7.4.200.0000.00816.68
7.4.190.0030.00316.77
7.4.160.0040.01116.49
7.4.150.0130.00617.40
7.4.140.0110.01117.86
7.4.130.0090.00716.51
7.4.120.0110.00816.53
7.4.110.0160.00716.46
7.4.100.0120.00616.45
7.4.90.0090.00916.52
7.4.80.0040.01419.39
7.4.70.0030.01316.48
7.4.60.0030.01316.38
7.4.50.0040.00416.63
7.4.40.0040.00422.77
7.4.30.0070.01016.48
7.4.00.0080.00814.92
7.3.330.0050.00013.32
7.3.320.0000.00613.29
7.3.310.0080.00016.14
7.3.300.0000.00716.28
7.3.290.0090.00616.31
7.3.280.0100.00716.31
7.3.270.0100.00717.40
7.3.260.0160.00716.44
7.3.250.0130.00716.63
7.3.240.0090.00916.29
7.3.230.0110.00616.49
7.3.210.0130.00316.55
7.3.200.0070.01019.39
7.3.190.0140.00316.69
7.3.180.0070.00716.56
7.3.170.0130.00316.67
7.3.160.0080.00816.44
7.3.120.0070.01015.09
7.2.330.0120.00916.65
7.2.320.0060.01216.83
7.2.310.0140.00316.82
7.2.300.0070.01016.67
7.2.290.0080.00816.60
7.2.60.0030.01017.04
7.1.200.0100.00015.88
7.1.70.0000.00716.95
7.1.60.0140.01019.82
7.1.50.0170.01017.04
7.1.00.0000.08022.39
7.0.200.0060.00616.94
7.0.140.0000.07022.09
7.0.60.0000.07020.06
7.0.50.0070.07317.90
7.0.40.0200.07020.13
7.0.30.0270.06720.33
7.0.20.0270.08320.23
7.0.10.0030.05320.23
7.0.00.0070.09320.19
5.6.280.0070.07020.79
5.6.210.0000.04720.72
5.6.200.0100.05018.16
5.6.190.0070.08320.50
5.6.180.3530.03720.64
5.6.170.0300.07320.50
5.6.160.0030.09020.54
5.6.150.0030.07718.18
5.6.140.0070.08318.23
5.6.130.0030.06718.28
5.6.120.0130.06320.91
5.6.110.0130.07720.98
5.6.100.0030.04021.00
5.6.90.0030.07721.09
5.6.80.0100.08020.40
5.6.70.4500.03720.38
5.5.350.0200.04320.43
5.5.340.0100.07718.05
5.5.330.0130.04720.36
5.5.320.0370.07320.35
5.5.310.0130.04320.25
5.5.300.0070.04317.95
5.5.290.0070.03717.99
5.5.280.0030.04320.91
5.5.270.0100.08020.73
5.5.260.0100.06320.85
5.5.250.0130.07720.70
5.5.240.0170.04020.06
5.4.450.0170.07319.64
5.4.440.0570.05319.16
5.4.430.0130.05319.68
5.4.420.0130.05319.52
5.4.410.0170.05019.41
5.4.400.1670.00018.62
5.4.390.1670.00018.52
5.4.380.0430.05318.56
5.4.370.0100.05318.80
5.4.360.0130.05318.76
5.4.350.0170.05018.71
5.4.340.0200.05018.78
5.4.320.0070.03812.52
5.4.310.0060.03712.52
5.4.300.0050.03812.52
5.4.290.0050.03912.52
5.4.280.0040.03612.41
5.4.270.0200.06718.94
5.4.260.0130.05718.81
5.4.250.0100.05718.90
5.4.240.0130.05318.79
5.4.230.0100.05318.65
5.4.220.0070.05718.84
5.4.210.0130.05319.00
5.4.200.0100.05318.77
5.4.190.0230.07018.94
5.4.180.0170.04718.83
5.4.170.0100.05318.64
5.4.160.0200.06318.93
5.4.150.0100.05318.73
5.4.140.0230.04016.47
5.4.130.0130.06316.40
5.4.120.0030.05316.65
5.4.110.0100.05016.38
5.4.100.0100.05016.61
5.4.90.0130.06016.41
5.4.80.0200.06016.45
5.4.70.0100.06316.37
5.4.60.0030.06016.48
5.4.50.0000.05716.39
5.4.40.0130.04716.41
5.4.30.0100.05716.47
5.4.20.0070.07316.59
5.4.10.0130.04716.30
5.4.00.0100.06716.00
5.3.290.0050.04212.80
5.3.280.0030.05714.70
5.3.270.0230.07714.79
5.3.260.0130.06014.78
5.3.250.0200.04714.63
5.3.240.0130.07314.64
5.3.230.0070.05314.70
5.3.220.0100.07014.67
5.3.210.0170.07014.75
5.3.200.0100.06714.55
5.3.190.0200.04014.66
5.3.180.0130.07014.71
5.3.170.0130.07014.75
5.3.160.0130.06014.48
5.3.150.0130.07714.80
5.3.140.0100.06014.40
5.3.130.0230.06014.39
5.3.120.0100.06314.55
5.3.110.0230.06014.73
5.3.100.0100.05314.06
5.3.90.0070.06714.10
5.3.80.0070.06314.26
5.3.70.0100.06014.04
5.3.60.0230.05013.84
5.3.50.0200.06014.04
5.3.40.0000.06013.88
5.3.30.0070.06713.76
5.3.20.0100.06313.84
5.3.10.0200.06013.84
5.3.00.0170.05313.57
5.2.170.0100.04011.26
5.2.160.0070.05711.26
5.2.150.0070.06011.13
5.2.140.0070.04011.18
5.2.130.0100.05711.19
5.2.120.0100.04711.31
5.2.110.0100.04311.20
5.2.100.0070.03711.12
5.2.90.0100.05011.04
5.2.80.0100.05311.11
5.2.70.0030.06311.13
5.2.60.0100.04311.30
5.2.50.0000.04711.23
5.2.40.0170.03011.09
5.2.30.0100.05710.98
5.2.20.0100.03711.13
5.2.10.0000.04311.05
5.2.00.0130.04310.73
5.1.60.0070.0479.85
5.1.50.0030.05010.21
5.1.40.0100.0379.95
5.1.30.0100.03310.43
5.1.20.0170.03010.44
5.1.10.0070.04710.16
5.1.00.0030.04010.15
5.0.50.0070.0408.48
5.0.40.0070.0278.58
5.0.30.0000.0478.41
5.0.20.0100.0338.41
5.0.10.0130.0278.43
5.0.00.0170.0408.24
4.4.90.0070.0177.23
4.4.80.0130.0207.23
4.4.70.0070.0177.23
4.4.60.0000.0307.23
4.4.50.0000.0237.23
4.4.40.0030.0377.23
4.4.30.0070.0207.23
4.4.20.0000.0237.23
4.4.10.0100.0177.23
4.4.00.0000.0377.23
4.3.110.0030.0207.23
4.3.100.0000.0237.23
4.3.90.0030.0307.23
4.3.80.0000.0407.23
4.3.70.0000.0337.23
4.3.60.0070.0277.23
4.3.50.0030.0277.23
4.3.40.0100.0377.23
4.3.30.0070.0177.23
4.3.20.0000.0237.23
4.3.10.0000.0307.23
4.3.00.0100.0178.17

preferences:
53.83 ms | 401 KiB | 5 Q