3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstr = <<<XML <a> <bs> <b>1</b> <b>2</b> </bs> </a> XML; $xml = new SimpleXMLElement($xmlstr); echo count($xml->bs); // 1 ← echo count($xml->bs->b); // 2 $xmlstr2 = <<<XML <bs> <b>1</b> <b>2</b> </bs> XML; $xml2 = new SimpleXMLElement($xmlstr2); echo count($xml2); // 2 ← echo count($xml2->b); // 2 echo "\n"; var_dump($xml->bs, $xml2);
Output for git.master, git.master_jit, rfc.property-hooks
1222 object(SimpleXMLElement)#2 (1) { ["b"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } } object(SimpleXMLElement)#4 (1) { ["b"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } }

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:
33.41 ms | 401 KiB | 8 Q