3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = '<root> <Formula> <formulaname attr="1.0">Basic</formulaname> <movespeed>1</movespeed> <box>4</box> <chicken>3</chicken> <ducks> <duck>test1</duck> <duck a="b">test2</duck> <duck>test3</duck> </ducks> <cereal>2</cereal> </Formula> </root>'; $xml = simplexml_load_string($s); $arr = (array) $xml; $newArr = (array)$arr['Formula']; $it = new SimpleXMLIterator($arr['Formula']->ducks); var_dump($arr['Formula']->ducks, $it->next());
Output for git.master, git.master_jit, rfc.property-hooks
Warning: SimpleXMLElement::__construct(): Entity: line 5: parser error : Start tag expected, '<' not found in /in/haTB1 on line 21 Warning: SimpleXMLElement::__construct(): in /in/haTB1 on line 21 Warning: SimpleXMLElement::__construct(): ^ in /in/haTB1 on line 21 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/haTB1:21 Stack trace: #0 /in/haTB1(21): SimpleXMLElement->__construct('\n \n \n \n') #1 {main} thrown in /in/haTB1 on line 21
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:
40.62 ms | 402 KiB | 8 Q