libxml_get_last_error
Description
The libxml_get_last_error of libxml for PHP retrieves the last error from libxml.
Syntax
libxml_get_last_error(): LibXMLError|false
Return
Returns a LibXMLError object if there is any error in the buffer, false otherwise.
Examples
1 · void
<? $use_errors = true; libxml_use_internal_errors($use_errors); $data = <<<XML <?xml version="1."?> <books> <book> <titlex>title</title> </book> </books> XML; $simplexml_load_string = simplexml_load_string($data); if($simplexml_load_string === false) { $return = libxml_get_last_error(); print_r($return); } ?>
LibXMLError Object ( [level] => 3 [code] => 76 [column] => 24 [message] => Opening and ending tag mismatch: titlex line 4 and title [file] => [line] => 4 )