Tag Archives: Error

error_log

It sends an error to the server error-log
Example

<?php
$value=2;
if ($value>1){
error_log(“An error occured”,1,”info@phpcodez.com”,”From: from@phpcodez.com”);
}
?>

Output
Error  message will be sent to the given  email address

debug_backtrace

It generate a generates a backtrace and displays data from the code that led up to the debug_backtrace() function.
Example

<?php
echo “<pre>”;
function back($arg1, $arg2) {
print_r(debug_backtrace());
}
back(“test1”, “test2”);
?>

The possible elements that can be returned are given below

function,line,file,class,object,type,Returns: “->” ,Returns: “::” ,Returns nothing,args

Output

Array
(
[0] => Array
(
[file] => /var/www/test/index.php
[line] => 6
[function] => back
[args] => Array
(
[0] => Peter
[1] => Griffin
)

)

)

Error functions