Re: question on order of variables passed to a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vidyut Luther wrote:
<?php
myErrorHandler($errno, $errstr, $errfile, $errline)
{
  switch ($errno) {
  case E_USER_ERROR:
 .....

}
?>

and then:
<?php
trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", E_USER_ERROR);
?>

So, wouldn't this make $errno in the "myErrorHandler" be "log (x) ...." rather than E_USER_ERROR ?

No, because you're calling trigger_error, not myErrorHandler.

The order of parameters for trigger_error is as follows[1]:
bool trigger_error ( string error_msg [, int error_type] )

trigger_error will, when called, either call your user-defined handler with the correct errno, errstr, errfile, errline etc, or, if you haven't defined one, it will use the error handling methods set up in PHP (log_errors or display_errors).

HTH

Jasper

[1] http://www.php.net/trigger_error

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux