3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = simplexml_load_string('<a><![CDATA[OK]]></a>', null, LIBXML_NOCDATA ); var_dump($xml); var_dump($xml['a']); var_dump($xml->a); $content = simplexml_load_string( '<content><![CDATA[Hello, world!]]></content>' , null , LIBXML_NOCDATA ); var_dump($content);
based on eccaO
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0rc3
object(SimpleXMLElement)#1 (1) { [0]=> string(2) "OK" } NULL object(SimpleXMLElement)#2 (0) { } object(SimpleXMLElement)#2 (1) { [0]=> string(13) "Hello, world!" }
Output for hhvm-3.15.4
Warning: simplexml_load_string() expects parameter 2 to be string, null given in /in/3UcRn on line 3 NULL NULL Notice: Cannot access property on non-object in /in/3UcRn on line 6 NULL Warning: simplexml_load_string() expects parameter 2 to be string, null given in /in/3UcRn on line 12 NULL