3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class HTMLDecorator { /** @var \ArrayObject */ protected $notes; public function format(){ $html = ''; foreach ($this->getNodes() as $node) $html .= "<p>{$node}</p>"; return $html; } } class HTML extends HTMLDecorator{ public function __construct(){ $this->nodes = new \ArrayObject(); } public function getNodes(){ return $this->nodes; } } class BlockHtml extends HTMLDecorator{ protected $html; public function __construct(HTMLDecorator $html){ $this->html = $html; } public function getNodes() { $this->html->getNodes()->append('Block html'); return $this->html->getNodes(); } } class ImageHtml extends HTMLDecorator{ protected $html; public function __construct(HTMLDecorator $html){ $this->html = $html; } public function getNodes() { $this->html->getNodes()->append('Image html'); return $this->html->getNodes(); } } $html = new HTML() $html = BlockHTML($html); $html = ImageHTML($html); echo $html->format();

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.280.0180.05312.41
5.4.270.0160.06712.41
5.4.260.0080.06712.41
5.4.250.0160.08112.41
5.4.240.0220.07612.41
5.4.230.0210.10312.40
5.4.220.0340.09512.40
5.4.210.0210.12512.40
5.4.200.0100.07912.40
5.4.190.0100.07212.39
5.4.180.0230.07612.39
5.4.170.0090.07412.41
5.4.160.0090.06412.40
5.4.150.0110.06812.39
5.4.140.0110.04412.09
5.4.130.0030.05212.07
5.4.120.0170.08912.04
5.4.110.0160.09312.03
5.4.100.0200.09912.03
5.4.90.0100.06912.03
5.4.80.0130.07012.03
5.4.70.0090.06312.03
5.4.60.0160.06312.03
5.4.50.0110.05412.02
5.4.40.0120.05212.01
5.4.30.0210.08212.01
5.4.20.0170.08312.00
5.4.10.0170.07812.01
5.4.00.0160.05511.50
5.3.280.0210.09312.71
5.3.270.0230.10712.72
5.3.260.0260.12312.72
5.3.250.0160.10612.72
5.3.240.0120.08312.72
5.3.230.0140.06612.71
5.3.220.0210.09412.68
5.3.210.0190.08312.68
5.3.200.0270.06612.68
5.3.190.0220.07012.68
5.3.180.0050.06512.67
5.3.170.0100.05912.67
5.3.160.0070.06112.68
5.3.150.0070.06312.67
5.3.140.0080.05812.66
5.3.130.0120.06612.66
5.3.120.0140.07612.66
5.3.110.0180.09012.66
5.3.100.0150.07212.13
5.3.90.0150.07912.11
5.3.80.0150.03912.09
5.3.70.0200.05112.09
5.3.60.0180.06512.07
5.3.50.0230.07612.03
5.3.40.0200.09012.03
5.3.30.0150.09211.98
5.3.20.0130.07211.77
5.3.10.0160.11711.73
5.3.00.0150.07711.72
5.2.170.0030.0479.21
5.2.160.0070.0399.21
5.2.150.0080.0499.21
5.2.140.0150.0799.20
5.2.130.0120.0549.16
5.2.120.0050.0519.16
5.2.110.0070.0479.17
5.2.100.0130.0629.16
5.2.90.0060.0339.16
5.2.80.0100.0309.16
5.2.70.0070.0499.16
5.2.60.0090.0409.12
5.2.50.0040.0349.09
5.2.40.0120.0499.06
5.2.30.0130.0469.04
5.2.20.0150.0409.02
5.2.10.0100.0348.93
5.2.00.0120.0398.80
5.1.60.0110.0368.09
5.1.50.0060.0688.09
5.1.40.0100.0508.07
5.1.30.0230.0968.41
5.1.20.0130.0588.43
5.1.10.0100.0508.16
5.1.00.0080.0778.16
5.0.50.0110.0276.64
5.0.40.0080.0676.50
5.0.30.0060.0536.31
5.0.20.0140.0426.27
5.0.10.0080.0326.26
5.0.00.0040.0506.25
4.4.90.0120.0414.78
4.4.80.0040.0424.76
4.4.70.0140.0374.76
4.4.60.0070.0284.75
4.4.50.0060.0204.77
4.4.40.0100.0624.71
4.4.30.0060.0234.76
4.4.20.0070.0204.84
4.4.10.0050.0224.85
4.4.00.0050.0594.75
4.3.110.0080.0484.67
4.3.100.0040.0254.66
4.3.90.0040.0454.63
4.3.80.0110.0524.59
4.3.70.0050.0414.63
4.3.60.0050.0194.63
4.3.50.0000.0294.62
4.3.40.0080.0284.53
4.3.30.0030.0183.27
4.3.20.0050.0233.25
4.3.10.0030.0183.22
4.3.00.0030.01313.22

preferences:
141.13 ms | 1394 KiB | 7 Q