[KLUG Members] Exceptions in PHP

Adam Tauno Williams members@kalamazoolinux.org
Wed, 5 Feb 2003 15:17:44 -0500


>>Is there any equivalent in PHP to "exceptions" and "expection handlers"
>like in C/C++
>Perhaps not quite... have you RTFP'ed the following:
>http://www.php.net/manual/en/ref.errorfunc.php

Ah ha -

function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars) {
  ....
 }

set_error_handler("userErrorHandler");

managed to blunder right over that one.

and for "throwing" exceptions there is -
void trigger_error ( string error_msg [, int error_type])

Unfortunately I don't see any evidence that there is any scope to the declarations.