3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = new SimpleXMLElement( '<person> <child role="son"> <child role="daughter"/> </child> <child_under role="daughter"> <child role="son"> <child role="son"/> </child> </child> </person>'); foreach ($xml->children() as $second_gen) { echo ' The person begot a ' . $second_gen['role']; foreach ($second_gen->children() as $third_gen) { echo ' who begot a ' . $third_gen['role'] . ';'; foreach ($third_gen->children() as $fourth_gen) { echo ' and that ' . $third_gen['role'] . ' begot a ' . $fourth_gen['role']; } } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Opening and ending tag mismatch: child_under line 5 and child in /in/8OBJX on line 2 Warning: SimpleXMLElement::__construct(): </child> in /in/8OBJX on line 2 Warning: SimpleXMLElement::__construct(): ^ in /in/8OBJX on line 2 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/8OBJX:2 Stack trace: #0 /in/8OBJX(2): SimpleXMLElement->__construct('<person>\n <chil...') #1 {main} thrown in /in/8OBJX on line 2
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.03 ms | 401 KiB | 8 Q