Fatal errors crash the program. There are three types of fatal errors in PHP:
Startup fatal error: This error occurs when a system can’t run the code during installation.
Compile time fatal error: This error occurs if a call is made to a non-existent code or variable.
Runtime fatal error: This error occurs while the program is running, and will cause the program to quit.
The following code tried to call a function name without declaring the function. This gives a fatal error:
<?php name("John", "Smith"); echo 'Success!'; ?>
Notice how the print statement is not executed. This is because, as soon as a fatal error is thrown, the code stops compiling.
View all Courses