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.21, 7.4.0 - 7.4.9, 8.0.0alpha1 - beta1
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) }