3v4l.org

run code in 300+ PHP versions simultaneously
<?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;
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.30, 7.4.0 - 7.4.23, 8.0.0 - 8.0.10, 8.1rc1 - rc2
this is &amp;lt;mystring&gt; &amp;euro; &amp;gt; $ this is <mystring> &euro; > $ this is &lt;mystring&gt; &amp;euro; &gt; $

preferences:
1517.66 ms | 460 KiB | 5 Q