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'; } echo $area;

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.0150.00418.30
8.3.50.0130.00922.05
8.3.40.0150.00318.92
8.3.30.0150.00019.10
8.3.20.0040.00420.39
8.3.10.0070.00022.09
8.3.00.0040.00422.29
8.2.180.0040.01116.38
8.2.170.0110.00422.96
8.2.160.0080.00620.52
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0050.00226.16
8.2.120.0040.00417.63
8.2.110.0030.01422.10
8.2.100.0040.00717.84
8.2.90.0080.00019.23
8.2.80.0040.00418.04
8.2.70.0040.00417.50
8.2.60.0050.00318.05
8.2.50.0030.00718.07
8.2.40.0070.00018.22
8.2.30.0080.00018.03
8.2.20.0000.00717.64
8.2.10.0050.00319.51
8.2.00.0050.00217.68
8.1.280.0080.00625.92
8.1.270.0040.00421.84
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.76
8.1.230.0070.00419.00
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0060.00317.23
8.1.190.0080.00017.63
8.1.180.0000.00818.10
8.1.170.0080.00018.47
8.1.160.0040.00421.95
8.1.150.0080.00018.55
8.1.140.0060.00317.43
8.1.130.0000.00717.84
8.1.120.0000.00717.34
8.1.110.0040.00417.41
8.1.100.0040.00417.52
8.1.90.0040.00417.52
8.1.80.0000.00717.35
8.1.70.0030.00317.42
8.1.60.0000.00817.61
8.1.50.0040.00417.58
8.1.40.0040.00417.40
8.1.30.0060.00317.58
8.1.20.0030.00517.59
8.1.10.0030.00617.63
8.1.00.0000.00917.54
8.0.300.0030.00518.77
8.0.290.0040.00417.04
8.0.280.0000.00718.39
8.0.270.0070.00017.21
8.0.260.0040.00416.86
8.0.250.0030.00317.01
8.0.240.0070.00016.92
8.0.230.0030.00717.07
8.0.220.0000.00716.86
8.0.210.0000.00716.96
8.0.200.0000.00617.09
8.0.190.0060.00316.95
8.0.180.0070.00016.96
8.0.170.0060.00317.04
8.0.160.0080.00016.98
8.0.150.0000.00816.81
8.0.140.0040.00416.94
8.0.130.0000.00713.37
8.0.120.0060.00316.94
8.0.110.0040.00417.02
8.0.100.0050.00216.91
8.0.90.0030.00517.01
8.0.80.0080.00816.94
8.0.70.0000.00716.98
8.0.60.0070.00017.08
8.0.50.0000.00817.03
8.0.30.0090.01017.19
8.0.20.0090.01017.40
8.0.10.0080.00017.05
8.0.00.0080.01316.97
7.4.330.0020.00215.08
7.4.320.0000.00616.57
7.4.300.0060.00016.60
7.4.290.0000.00716.50
7.4.280.0030.00316.64
7.4.270.0030.00316.62
7.4.260.0040.00416.59
7.4.250.0030.00516.48
7.4.240.0030.00516.52
7.4.230.0000.00816.64
7.4.220.0090.00916.61
7.4.210.0080.00816.55
7.4.200.0030.00516.60
7.4.190.0050.00316.42
7.4.160.0090.00916.50
7.4.150.0110.01117.40
7.4.140.0140.00517.86
7.4.130.0100.00716.60
7.4.120.0110.00716.54
7.4.110.0100.00716.67
7.4.100.0110.01116.66
7.4.90.0090.01016.64
7.4.80.0100.00719.39
7.4.70.0120.00616.49
7.4.60.0070.01016.46
7.4.50.0000.00616.29
7.4.40.0090.00622.77
7.4.30.0030.01416.59
7.4.00.0040.00914.95
7.3.330.0000.00513.19
7.3.320.0050.00013.35
7.3.310.0030.00616.28
7.3.300.0070.00016.19
7.3.290.0110.00816.32
7.3.280.0090.00816.32
7.3.270.0090.00717.40
7.3.260.0130.01016.32
7.3.250.0100.01216.59
7.3.240.0130.00316.46
7.3.230.0070.01116.39
7.3.210.0090.01516.26
7.3.200.0110.01119.39
7.3.190.0070.01116.48
7.3.180.0110.00516.69
7.3.170.0100.00716.38
7.3.160.0030.01316.28
7.3.120.0070.01014.80
7.2.330.0150.00316.46
7.2.320.0140.00416.55
7.2.310.0140.00316.80
7.2.300.0090.00916.86
7.2.290.0040.01216.85
7.2.00.0030.00918.96
7.1.100.0070.01018.46
7.1.70.0000.01017.34
7.1.60.0100.01019.82
7.1.50.0120.01217.06
7.1.00.0070.06722.31
7.0.200.0060.00616.82
7.0.140.0000.09722.09
7.0.60.0000.08320.03
7.0.50.0130.04017.91
7.0.40.0030.09019.96
7.0.30.0270.06020.34
7.0.20.0230.08320.10
7.0.10.0300.09020.21
7.0.00.0070.09020.19
5.6.280.0100.06721.13
5.6.210.0100.03320.64
5.6.200.0070.04718.16
5.6.190.0070.04020.52
5.6.180.3200.04720.64
5.6.170.0230.04320.55
5.6.160.0100.04320.54
5.6.150.0130.07318.18
5.6.140.0070.06318.13
5.6.130.0000.04318.19
5.6.120.0030.04021.01
5.6.110.0170.03721.00
5.6.100.0100.06720.96
5.6.90.0030.04720.99
5.6.80.0100.05720.39
5.6.70.0230.08020.52
5.5.350.0100.06020.41
5.5.340.0070.08018.05
5.5.330.0170.07720.35
5.5.320.0170.04020.27
5.5.310.0230.05020.20
5.5.300.0000.07317.95
5.5.290.0070.08317.96
5.5.280.0230.04320.98
5.5.270.0070.08020.77
5.5.260.0100.07720.77
5.5.250.0070.05320.63
5.5.240.0070.07320.30
5.4.450.0200.05018.98
5.4.440.0300.07019.18
5.4.430.0100.05319.21
5.4.420.0130.05719.68
5.4.410.0070.05719.27
5.4.400.0800.00018.55
5.4.390.0730.00018.79
5.4.380.0400.05318.71
5.4.370.0200.05018.83
5.4.360.0170.05318.77
5.4.350.0200.05718.84
5.4.340.0370.03718.52
5.4.320.0090.03912.52
5.4.310.0100.04412.52
5.4.300.0050.03712.52
5.4.290.0060.04212.52
5.4.280.0060.03612.41
5.4.270.0100.05718.96
5.4.260.0230.06319.02
5.4.250.0170.10019.10
5.4.240.0070.05719.00
5.4.230.0170.05318.77
5.4.220.0130.06318.85
5.4.210.0170.06018.97
5.4.200.0270.05018.94
5.4.190.0200.06718.99
5.4.180.0070.06318.99
5.4.170.0070.06018.79
5.4.160.0100.07719.02
5.4.150.0070.07718.98
5.4.140.0070.06016.47
5.4.130.0130.07016.39
5.4.120.0170.06716.45
5.4.110.0170.05716.71
5.4.100.0170.06316.71
5.4.90.0170.06016.53
5.4.80.0100.05716.46
5.4.70.0100.05016.52
5.4.60.0270.04016.39
5.4.50.0030.05716.46
5.4.40.0070.05016.68
5.4.30.0070.04716.38
5.4.20.0070.05016.39
5.4.10.0070.06016.52
5.4.00.0070.06315.86
5.3.290.0090.04212.80
5.3.280.0030.08014.44
5.3.270.0130.07014.80
5.3.260.0070.06014.71
5.3.250.0170.06714.79
5.3.240.0170.04714.72
5.3.230.0200.05014.75
5.3.220.0030.07714.66
5.3.210.0000.07314.66
5.3.200.0200.05714.67
5.3.190.0100.06714.57
5.3.180.0000.06314.65
5.3.170.0130.06314.50
5.3.160.0100.05014.59
5.3.150.0100.07014.60
5.3.140.0030.06014.66
5.3.130.0070.05314.73
5.3.120.0070.07714.72
5.3.110.0070.05014.79
5.3.100.0130.04714.20
5.3.90.0100.05013.87
5.3.80.0070.07014.11
5.3.70.0170.06014.01
5.3.60.0100.04714.12
5.3.50.0030.07313.88
5.3.40.0170.06313.97
5.3.30.0130.06013.97
5.3.20.0030.05013.80
5.3.10.0070.07013.64
5.3.00.0070.07013.84
5.2.170.0130.05011.16
5.2.160.0100.04011.24
5.2.150.0070.05011.13
5.2.140.0070.05711.34
5.2.130.0000.05011.11
5.2.120.0000.06310.95
5.2.110.0030.04010.97
5.2.100.0230.04311.07
5.2.90.0070.05011.21
5.2.80.0170.02711.11
5.2.70.0070.04311.18
5.2.60.0170.02711.24
5.2.50.0170.03311.04
5.2.40.0100.05011.01
5.2.30.0130.05311.17
5.2.20.0130.03311.05
5.2.10.0030.04010.96
5.2.00.0030.05010.82
5.1.60.0000.04310.01
5.1.50.0000.03710.00
5.1.40.0070.03710.05
5.1.30.0030.05310.27
5.1.20.0070.05310.45
5.1.10.0030.03710.09
5.1.00.0030.03710.04
5.0.50.0000.0338.53
5.0.40.0070.0278.41
5.0.30.0000.0478.48
5.0.20.0030.0278.31
5.0.10.0000.0338.20
5.0.00.0070.0478.22
4.4.90.0100.0237.20
4.4.80.0000.0237.20
4.4.70.0000.0237.20
4.4.60.0070.0177.20
4.4.50.0000.0237.20
4.4.40.0070.0337.20
4.4.30.0070.0177.20
4.4.20.0000.0237.20
4.4.10.0130.0177.20
4.4.00.0070.0407.20
4.3.110.0000.0237.20
4.3.100.0100.0177.20
4.3.90.0030.0237.20
4.3.80.0070.0307.20
4.3.70.0030.0237.20
4.3.60.0070.0277.20
4.3.50.0070.0207.20
4.3.40.0100.0307.20
4.3.30.0100.0237.20
4.3.20.0100.0137.20
4.3.10.0000.0237.20
4.3.00.0030.0205.88

preferences:
29.38 ms | 401 KiB | 5 Q