3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "* XML:\n"; echo simplexml_load_string('<foo>123</foo>'); echo "\n---\n"; echo "* PHP <?= echo shortcut:\n"; echo simplexml_load_string('<foo>456<?= bar(); ?></foo>'); echo "\n---\n"; echo "* PHP <?php but no ?>:\n"; echo simplexml_load_string('<foo>789<?php baz();</foo>'); echo "\n---\n"; echo "* PHP block with the ending tag:\n"; echo simplexml_load_string('<foo>abc<?php abc(); ?></foo>');
Output for 7.4.0 - 7.4.30, 8.0.1 - 8.0.20, 8.1.0 - 8.1.7
* XML: 123 --- * PHP <?= echo shortcut: Warning: simplexml_load_string(): Entity: line 1: parser error : xmlParsePI : no target name in /in/2sQ6N on line 7 Warning: simplexml_load_string(): <foo>456<?= bar(); ?></foo> in /in/2sQ6N on line 7 Warning: simplexml_load_string(): ^ in /in/2sQ6N on line 7 --- * PHP <?php but no ?>: Warning: simplexml_load_string(): Entity: line 1: parser error : ParsePI: PI php never end ... in /in/2sQ6N on line 11 Warning: simplexml_load_string(): <foo>789<?php baz();</foo> in /in/2sQ6N on line 11 Warning: simplexml_load_string(): ^ in /in/2sQ6N on line 11 Warning: simplexml_load_string(): Entity: line 1: parser error : Premature end of data in tag foo line 1 in /in/2sQ6N on line 11 Warning: simplexml_load_string(): <foo>789<?php baz();</foo> in /in/2sQ6N on line 11 Warning: simplexml_load_string(): ^ in /in/2sQ6N on line 11 --- * PHP block with the ending tag: abc

preferences:
25.08 ms | 412 KiB | 5 Q