Code: Select all
// the function looks like this
function ReportError($msg){
ini_set('sendmail_from','user@mail.com');
mail('own@mail.com','Error Report!',$msg);
}
// and i call it this way in another script
funtion DoStuff(){
// some code ...
if($ErrorCode!=0){
$msg = "An ".getErrorMsg($ErrorCode)." error occured while calling ".__FUNCTION__." of ".__FILE__;
ReportError($msg)
}
}One solution I thought of is to get this message format inside ReportError() so that only the $ErrorCode will be passed.
Code: Select all
function ReportError($ErrorCode){
$details = "An ".getErrorMsg($ErrorCode)." error occured while calling ".__FUNCTION__." of ".__FILE__;
ini_set('sendmail_from','user@mail.com');
mail('own@mail.com','Error Report!',$details);
}Is there any way to tell ReportError() what function called him?