<?php $date_array = getdate(); foreach ( $date_array as $key => $val ){ print "$key = $val<br />"; } $formated_date = "Today's date: "; $formated_date .= $date_array['mday'] . "/"; $formated_date .= $date_array['mon'] . "/"; $formated_date .= $date_array['year']; print $formated_date; ?>
<?php print time(); ?>
<?php if ($test<10) { user_error("Number cannot be less than 10"); } ?>
<?php if ($test<10) { trigger_error("Number cannot be less than 10"); } ?>
<?php function exception_handler($exception) { echo "Uncaught exception is : " , $exception->getMessage(), "\n"; } set_exception_handler('exception_handler'); set_exception_handler(); throw new Exception('Not Found Exception'); echo "not included Executed\n"; ?>
<?php function customError($errno, $errstr, $errfile, $errline) { echo "Custom error: [$errno] $errstr\n"; echo "Error on line $errline in $errfile\n"; echo "Ending Script"; die(); } //set error handler set_error_handler("customError"); $test = 0; //trigger error if ($test > -1) { trigger_error("A custom error has been triggered"); } ?>
<?php function unserialize_handler($errno, $errstr) { echo "Invalid hello value.\n"; } $hello = 'abc'; set_error_handler('unserialize_handler'); $original = unserialize($hello); restore_error_handler(); ?>
<?php echo $b; print_r(error_get_last()); ?>
<?php function one() { two(); } function two() { three(); } function three(){ debug_print_backtrace(); } one(); ?>
<?php function printStr($str) { echo "Hi: $str"; var_dump(debug_backtrace()); } printStr('hello'); ?>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more