php[world] 2017

Voting

Please answer this simple SPAM challenge: zero minus zero?
(Example: nine)

The Note You're Voting On

hweidmann at online dot de
1 year ago
catch doesn't check for the existence of the Exception class, so avoid typo.

<?php
  
class MyException extends Exception
  
{
      ...
   }

   try
   {
      throw new
MyException(...);
   }
   catch (
MuException $e) // <--- typo
  
{
      ...
   }
?>

You WON'T get
   Fatal error: Class MuException could not be loaded ...

You WILL get
   Fatal error: Uncaught exception 'MyException' ...

<< Back to user notes page

To Top