Bulgaria PHP Conference 2019

Voting

Please answer this simple SPAM challenge: min(nine, eight)?
(Example: nine)

The Note You're Voting On

daviddlowe dot flimm at gmail dot com
1 year ago
Starting in PHP 7, the classes Exception and Error both implement the Throwable interface. This means, if you want to catch both Error instances and Exception instances, you should catch Throwable objects, like this:

<?php

try {
    throw new
Error( "foobar" );
   
// or:
    // throw new Exception( "foobar" );
}
catch (
Throwable $e) {
   
var_export( $e );
}

?>

<< Back to user notes page

To Top