Errors

Содержание

Introduction

Sadly, no matter how careful we are when writing our code, errors are a fact of life. PHP will report errors, warnings and notices for many common coding and runtime problems, and knowing how to detect and handle these errors will make debugging much easier.

Коментарии

Автор:
<?php

// You might not be able to notice that a "Fatal error" occurred in some cases.

try{

    throw new 
Exception('An exception!');

}catch (
Exception $e){

   
undefined_function(); // causes a "Fatal error"

}finally{

$html = <<<HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div style="margin:15em 1em">
<p>Even if you remove "die()" at the end of this script, 
<p>in case that Finally block shows you a window-height content,
<p>you might not be able to notice
<p>that a "Fatal error" occurred.
</div>
</body>
</html>
HTML;

echo 
$html;
die(); 
// if you remove this line, you can see the "Fatal error" message about undefined_function(). But in case "Finally block" shows you a window-height content, it might be difficult to notice that a fatal error occurred because the "Fatal error" message appears after the Finally block process (in PHP 8.3.10).

}
2024-08-11 01:51:29
http://php5.kiev.ua/manual/ru/language.errors.html

    Поддержать сайт на родительском проекте КГБ