07-18-2008, 11:53 PM
|
#7 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
You can use exceptions, which boiled down would look something like;
PHP Code:
try { userFunc($arg); } catch ($e Exception) { die($e->getMessage()); }
function userFunc ($arg) { if ($arg != $met) throw new exception('Condition not met'); }
Alternatively you can throw the exception from within the try{} block, it just needs to be thrown from somewhere within the try to be caught. There's also trigger_error() to throw your own errors (preferably in conjunction with a custom error handler).
-m
|
|
|
|