Fatal Error in PHP

What is meant by fatal error in php?

Explanation

Fatal errors are the critical errors - When representing an object of a non existent class or function, this error automatically terminates the script.

Example code :

<?php
function demo1()
{
echo "Welcome to HIOX!!";
}
demo2();
echo "Fatal Error !!";
?>
Result :
Fatal error: Call to undefined function demo2() in /opt/lampp/htdocs/Demo/sampletest.php on line 6

In the above code, demo2() function is not properly defined, so the output will be fatal error.

PHP Topics


Ask Questions

Ask Question