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.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
this is &amp;lt;mystring&gt; &amp;euro; &amp;gt; $ this is <mystring> &euro; > $ this is &lt;mystring&gt; &amp;euro; &gt; $

preferences:
179.39 ms | 403 KiB | 198 Q