Computer >> Computer tutorials >  >> Programming >> PHP

libxml_use_internal_errors() function in PHP


The libxml_use_internal_errors () function disable libxml errors and allow user to fetch error information as needed.

Syntax

libxml_use_internal_errors(err)

Parameters

  • err − If user error handling should be enabled. The default is FALSE

Return

The libxml_use_internal_errors () function returns the previous value of the err parameter stated above.

Example

The following is an example −

<?php
   var_dump(libxml_use_internal_errors(true));
   $mydoc = new DOMDocument;
   if (!$mydoc->load('new.xml')) {
      foreach (libxml_get_errors() as $error) {
         // handle the errors now
      }
      libxml_clear_errors();
   }
?>