3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); class A extends SimpleXMLElement { } $delimiter = "--------------------------------------------------------------------------------\n"; echo $delimiter; $xml1 = <<<XML <?xml version="1.0"?> <a> <b> <c> <value attr="Some Attr">Some Value</value> </c> </b> </a> XML; $a1 = new A($xml1); foreach ($a1->b->c->children() as $key => $value) { var_dump($value); } echo $delimiter; $xml2 = <<<XML <?xml version="1.0"?> <a> <b> <c><value attr="Some Attr">Some Value</value></c> </b> </a> XML; $a2 = new A($xml2); foreach ($a2->b->c->children() as $key => $value) { var_dump($value); } echo $delimiter;;
Output for 5.1.2 - 5.3.29, 5.5.27 - 5.5.38, 5.6.11 - 5.6.28, 7.0.0 - 7.1.0
-------------------------------------------------------------------------------- object(A)#2 (2) { ["@attributes"]=> array(1) { ["attr"]=> string(9) "Some Attr" } [0]=> string(10) "Some Value" } -------------------------------------------------------------------------------- object(A)#3 (2) { ["@attributes"]=> array(1) { ["attr"]=> string(9) "Some Attr" } [0]=> string(10) "Some Value" } --------------------------------------------------------------------------------
Output for hhvm-3.12.0
-------------------------------------------------------------------------------- object(A)#8 (2) { ["@attributes"]=> array(1) { ["attr"]=> string(9) "Some Attr" } [0]=> string(10) "Some Value" } -------------------------------------------------------------------------------- object(A)#16 (2) { ["@attributes"]=> array(1) { ["attr"]=> string(9) "Some Attr" } [0]=> string(10) "Some Value" } --------------------------------------------------------------------------------
Output for hhvm-3.10.0
-------------------------------------------------------------------------------- object(A)#8 (1) { ["@attributes"]=> array(1) { ["attr"]=> string(9) "Some Attr" } } -------------------------------------------------------------------------------- object(A)#16 (2) { ["@attributes"]=> array(1) { ["attr"]=> string(9) "Some Attr" } [0]=> string(10) "Some Value" } --------------------------------------------------------------------------------
Output for 5.4.0 - 5.5.26, 5.6.0 - 5.6.10
-------------------------------------------------------------------------------- object(A)#2 (1) { ["@attributes"]=> array(1) { ["attr"]=> string(9) "Some Attr" } } -------------------------------------------------------------------------------- object(A)#3 (2) { ["@attributes"]=> array(1) { ["attr"]=> string(9) "Some Attr" } [0]=> string(10) "Some Value" } --------------------------------------------------------------------------------
Output for 5.0.0 - 5.1.1
-------------------------------------------------------------------------------- object(A)#2 (1) { [0]=> string(10) "Some Value" } -------------------------------------------------------------------------------- object(A)#3 (1) { [0]=> string(10) "Some Value" } --------------------------------------------------------------------------------
Output for 4.3.2 - 4.4.9
Notice: Use of undefined constant E_STRICT - assumed 'E_STRICT' in /in/7o12W on line 3 Fatal error: Class a: Cannot inherit from undefined class simplexmlelement in /in/7o12W on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant E_STRICT - assumed 'E_STRICT' in /in/7o12W on line 3 Fatal error: Class a: Cannot inherit from undefined class simplexmlelement in /in/7o12W on line 5