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:
<?php
$fake_array = 'test';
?>
Next, I will create an if statement which will throw an error by testing our faked array
for the key 'Something':
<?php
if ( !in_array( 'Something', $fake_array ) )
{
trigger_error("Humph, you and I both know that wasn't an array", E_USER_NOTICE);
echo "An error has been posted to $log_file";
}
?>