 <?php
// Place this at the beginning of any script or place it in its own file and include it.

// Change the "From" and "To" in the below code:
function my_error_handler($number, $message, $file, $line, $vars){
    $headers = "From: noreply@example.com>\r\n";
    $headers .= "Content-type: text/plain; charset=utf-8\r\n";
    mail("me@gmail.com", "Code Errors", "Num: $number<br />\n"
        . "Msg: $message<br />\n"
        . "File: $file<br />\n"
        . "Line: $line<br />\n"
        . "var $vars", $headers);
}

set_error_handler('my_error_handler');

// The rest of the code here 