pTutorial

New way to learn PHP

PHP 5 Fatal Error and Notices

2. Fatal Error

A fatal Error occurs when there is a server problem with the content of the code, such as calling a function that has not been defined. The interpreter stops running the code when a fatal error is encountered.

Example

<?php
Echo "Calling undefined function";
Add();
?>

A user-defined function add () is called in the above code. At run time add () function can’t find the add () function, an error message is displayed in the browser.

2. Warning

Warning errors are fairly common and will not interrupt the script execution. Warnings are usually error, but it cannot prevent the execution of the script.

Example

<?php
Echo "Calling undefined function";
Add();
?>

PHP executes the code after giving the warning message.

3. Notices

Notices will never terminate the script and can be quite helpful. These will be displayed when PHP encounters something, which could also be correct, when the script is running.

Notices tell theProgrammer that the code it runs may be doing something unintentional, such a reading a variable which is undefined.

Example

<?php

Echo ($no * 10);

?>


QUOTES OF THE DAY

The heart of melody can never be put down.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER