errors throwing in php

PHP
function inverse($x) {
    if (!$x) {
        throw new Exception('Division by zero.');
    }
    return 1/$x;
}
Source

Also in PHP: