PHP 5 supports exceptions, via try, catch and throw.

The default exception is the Exception class.

<?php
define
('NUM'10);
try {
    if (
NUM 20) {
        throw new 
Exception(
            
NUM " is too small!"
        
);
    }
} catch (
Exception $e) {
    echo 
$e->getMessage();
    echo 
"\n<br />\n";
}
?>
Output
10 is too small!