PHP restore_exception_handler()

La fonction restore_exception_handler() est une fonction intégrée en PHP qui est utilisée pour restaurer le gestionnaire d’exceptions précédent après l’avoir modifié avec la fonction set_exception_handler().
 

Syntaxe
restore_exception_handler()

 
 

Paramètres

La fonction ne reçoit aucun argument.
 

Valeur de retour

La fonction renvoie toujours TRUE.
 

Version PHP:

4+
 

Exemple :
<?php
   function myException1($exception) {
      echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
   }
   function myException2($exception) {
      echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
   }

   set_exception_handler("myException1");
   set_exception_handler("myException2");

   restore_exception_handler();
   
   throw new Exception("Déclenche le premier gestionnaire d'exceptions!");
?>
Questions d'entretiens PHP

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *