code.progysm.com

throw

Description
	Lance une exception

Example
	throw new Exception('message');

	try {
	    throw new Exception('message');
	} catch (Exception $e) {
	    echo $e->getMessage();
	}

Note
    $x; // an exception of the class X
    Using throw new $x();  new $x() will call the constructor of the $x instance without parameter.
                           if X::__construct() need an argument, it will raise an Error: too few arguments for X::__construct()