Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Throwable

Throwable is a PHP native interface, which is required for any object to be used with thrown, such as Exception and Error.

This interface may be used with catch clauses, to catch everything that is thrown. Yet, this interface cannot be implemented directly. It should be acquired by extending Exception: extending Error should be avoided.

<?php

class x extends \Exception implements \Throwable {}

throw new X();

?>

Documentation

See Also