3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml_header = "<?xml version='1.0' encoding='utf-8'?><xml/>"; $xml = new SimpleXMLElement($xml_header); $xml->addChild("first_string"); $xml->first_string = "this is &amp;lt;mystring&gt; &amp;euro; &amp;gt; $"; $xml->addChild("first_string2"); $xml->first_string2 = "this is <mystring> &euro; > $"; $xml->addChild("second_string"); $xml->second_string = htmlentities("this is <mystring> &euro; > $"); echo $xml->first_string . "\n"; echo $xml->first_string2 . "\n"; echo $xml->second_string;
based on X14NK
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.1
this is &amp;lt;mystring&gt; &amp;euro; &amp;gt; $ this is <mystring> &euro; > $ this is &lt;mystring&gt; &amp;euro; &gt; $