#native_company# #native_desc#

File based, custom logging Page 3

By John Starkey
on September 30, 2002

Breaking the right rules

Ok, so we have our function ready to go for handling our logging calls. The next order of business
is to tell the parser that it should use this function for handling any errors. To do this, we will
use the set_error_handler() function as so:




Now, in order to see any results during this demonstration, we’ll need to create our
own error. To do this, I’ll use a simple in_array() on a string variable. So, first we
declare a variable with a string value:




Next, I will create an if statement which will throw an error by testing our faked array
for the key ‘Something’:


if ( !in_array'Something'$fake_array ) ) 


trigger_error("Humph, you and I both know that wasn't an array"E_USER_NOTICE); 

"An error has been posted to $log_file";