3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0"?> <config> <a>test</a> </other> XML; echo 'LOAD INVALID XML STRING' . PHP_EOL; $simpleXML = simplexml_load_string($xml); echo 'DETECTED ERROR:' . PHP_EOL; if ($simpleXML === false) { $err = error_get_last(); var_dump($err); }
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
LOAD INVALID XML STRING Warning: simplexml_load_string(): Entity: line 4: parser error : Opening and ending tag mismatch: config line 2 and other in /in/69E3Y on line 11 Warning: simplexml_load_string(): </other> in /in/69E3Y on line 11 Warning: simplexml_load_string(): ^ in /in/69E3Y on line 11 DETECTED ERROR: array(4) { ["type"]=> int(2) ["message"]=> string(34) "simplexml_load_string(): ^" ["file"]=> string(9) "/in/69E3Y" ["line"]=> int(11) }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 LOAD INVALID XML STRING Warning: simplexml_load_string(): Entity: line 4: parser error : Opening and ending tag mismatch: config line 2 and other in /in/69E3Y on line 11 Warning: simplexml_load_string(): </other> in /in/69E3Y on line 11 Warning: simplexml_load_string(): ^ in /in/69E3Y on line 11 DETECTED ERROR: array(4) { ["type"]=> int(2) ["message"]=> string(34) "simplexml_load_string(): ^" ["file"]=> string(9) "/in/69E3Y" ["line"]=> int(11) }

preferences:
158.69 ms | 403 KiB | 166 Q