note 33186 deleted from function.set-error-handler by sniper
| From: | sniper@php.net | Date: | Fri, 03 Oct 2003 05:37:55 +0000 |
| Subject: | note 33186 deleted from function.set-error-handler by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57653@lists.php.net to get a copy of this message | ||
Note Submitter: LouisGreen@pljg.freeserve.co.uk
----
I noticed if need to parse in a bit more information in the error handler, you can do something like
this:
<?php
function myErrorHandler ($data_type, $data_string, $data_file, $data_line, $data_varible)
{
list($data_string1,$data_string2) = explode(":",$data_string);
echo "<B>Message:</B> $data_type<br />";
echo "<B>String 1:</B> $data_string1<br />";
echo "<B>String 2:</B> $data_string2<br />";
echo "<B>File:</B> $data_file<br />";
echo "<B>Line:</B> $data_line<br />";
exit();
}
set_error_handler("myErrorHandler");
$info_string1 = "Test Fatal Error - ";
$info_string2 = "Code Stopped";
$info_string = $info_string1.":".$info_string2;
trigger_error($info_string, E_USER_ERROR);
?>