3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyXML extends SimpleXMLElement { public function firstChild() { $children = $this->children(); foreach ($children as $child) break; return $child; } public function keyHasTwins($key) { if (isset($this->$key)) return (count($this->$key)>1); else return false; } public function hasChildren() { return (bool)count($this->children()); } public function nodeIsCollection() { var_dump(count($this);exit; return (count); } } $s = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'. '<request>'. ' <body>'. ' <rows>'. ' <row id="1"/>'. ' <row id="2"/>'. ' <row id="3"/>'. ' <row2 ver="2.0">test data</row2>'. ' <row2 ver="2.1">test data 2</row2>'. ' <row3 ver="3.0">'. ' <test inherit="yes">data</test>'. ' </row3>'. ' </rows>'. ' </body>'. '</request>'; $obj = new MyXML($s); $row = $obj->firstChild()->firstChild()->row2; var_dump($row->nodeIsCollection());

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.140.0220.06012.07
5.4.130.0140.04412.05
5.4.120.0140.04312.01
5.4.110.0130.04412.01
5.4.100.0150.04412.01
5.4.90.0220.06112.01
5.4.80.0170.04412.01
5.4.70.0160.04312.00
5.4.60.0130.04412.01
5.4.50.0230.05712.00
5.4.40.0160.04311.99
5.4.30.0150.04411.99
5.4.20.0180.04011.98
5.4.10.0230.06411.99
5.4.00.0190.04811.48
5.3.240.0150.04512.72
5.3.230.0190.04312.71
5.3.220.0180.04412.68
5.3.210.0220.06112.68
5.3.200.0230.05012.68
5.3.190.0160.04612.68
5.3.180.0180.04212.67
5.3.170.0170.04612.67
5.3.160.0190.05112.67
5.3.150.0160.04512.67
5.3.140.0260.06712.66
5.3.130.0170.04312.66
5.3.120.0160.04612.66
5.3.110.0210.04012.66
5.3.100.0230.06112.12
5.3.90.0160.04512.10
5.3.80.0140.04512.09
5.3.70.0140.04712.09
5.3.60.0140.04712.07
5.3.50.0110.04812.02
5.3.40.0280.07212.02
5.3.30.0210.05911.98
5.3.20.0180.05011.76
5.3.10.0180.04911.72
5.3.00.0140.04511.71

preferences:
138.23 ms | 1394 KiB | 7 Q