It r restores the previous exception handler
Example
<?php
function customError($errno, $errstr, $errfile, $errline) {
echo $errno.””.$errstr.” , File name – “.$errfile.” at line No”.$errline;
}
set_error_handler(“customError”);
$val=5;
if ($val>1) trigger_error(“An error occured”);
restore_error_handler();
if ($val>5) trigger_error(“An error occured”);
?>
Output
exception_handler_1 – This triggers the first exception handler…
It restores the previous error handler
Example
<?php
function customError($errno, $errstr, $errfile, $errline) {
echo $errno.””.$errstr.” , File name – “.$errfile.” at line No”.$errline;
}
set_error_handler(“customError”);
$val=5;
if ($val>1) trigger_error(“An error occured”);
restore_error_handler();
if ($val>5) trigger_error(“An error occured”);
?>
Output
1024An error occured , File name – /var/www/test/date/date.php at line No11
It specifies which errors are occurred.
Example
<?php
error_reporting(E_ALL);
?>
E_ERROR ,E_WARNING,E_PARSE,E_NOTICE,E_CORE_ERROR,E_CORE_WARNING ,E_COMPILE_ERROR,E_COMPILE_WARNING,E_USER_ERROR,E_USER_WARNING,E_USER_NOTICE,E_STRICT ,E_RECOVERABLE_ERROR,E_ALL
Output
It shows all the errors occurred including waring,notice etc
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
It returns the last error occurred
Example
<?php
echo “<pre>”;
echo $test;
print_r(error_get_last());
?>
Output
Array
(
[type] => 8
[message] => Undefined variable: test
[file] => /var/www/test/index.php
[line] => 3
)
It prints a backtrace
Example
<?php
echo “<pre>”;
function back($arg1, $arg2) {
debug_print_backtrace();
}
back(“test1”, “test2”);
?>
Output
#0 back(Peter, Griffin) called at [/var/www/test/index.php:6]
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
)
)
)
Julian day is used in the Julian date (JD) system of time measurement for scientific use by the astronomy community, presenting the interval of time in days and fractions of a day since January 1, 4713 BC Greenwich noon. Julian date is recommended for astronomical use by the International Astronomical Union.
The Julian Day Number (JDN) is the Julian day with the fractional part ignored. It is sometimes used in calendrical calculation, in which case, JDN 0 is used for the date equivalent to Monday January 1, 4713 BC in the Julian calendar.
The term Julian date is widely used to refer to the day-of-year (ordinal date) although incorrectly.
It convert Unix timestamp to Julian Day
Example
<?php
echo unixtojd();
?>
Output
2456045
It converts a Julian Calendar date to Julian Day Count
Example
<?php
$jdate = juliantojd(8,4,1976);
echo $jdate . “<br />”;
$julian = jdtojulian($jdate);
echo $julian;
?>
Output
2443008
8/4/1976
Posts navigation
Zend | Magento Certified PHP | eCommerce Architect