What are the different errors in PHP?
Basically there are four types of runtime errors in PHP.The error message is sent to the browser with filename, line number and a message describing the error.
1.Notice error:These errors are non critical that php encounters while executing a script. This error occurs mostly while accessing a variable that has not yet been defined.
2. Warning error:These are more serious errors.By default these errors are displayed to the user,but they do not result in script termination.Mostl my warning errors are due to include a missing file or using the incorrect number of parameters in a function.
3.Fatal error: These are critical errors.These errors cause the immediate termination of script,if we are trying to instantiating an object of a non existent class,or calling a non existent function,then the output is a fatal error that stops the execution of script.
4.Parse error: These are critical errors occurs if there is a syntax mistake in the script.Parse error also stops the execution of script.The common reasons for parse errors are unclosed quotes,missing or extra parentheses, unclosed braces, missing semicolon.
Error is the fault or mistake in a program. Error can occur due to wrong syntax or wrong logic.
It is the type of error done by the programmer in the source code of the program. The syntax error is caught by the compiler. Parse errors can be caused dues to unclosed quotes, missing or Extra parentheses, Unclosed braces, Missing semicolon etc
It is the type of error where PHP compiler understand the PHP code but it recognizes an undeclared function.
The main reason of warning errors are including a missing file.
It means that the program contains something wrong but it allows the execution of script.
Error occurs during run time of you code if you code is wrong or there is a syntax mistake. The different types of error levels for error handling are,
Fatal run-time errors. Execution of the script is halted.
Non-fatal run-time errors. Execution of the script is not halted
Compile-time parse errors. Parse errors should only be generated by the parser.
Fatal errors that occur during PHP's initial start-up.
Fatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error()
Run-time notices. Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code.
Catchable fatal error. This is like an E_ERROR but can be caught by a user defined handle (see also set_error_handler())
All the above error level can be set using following PHP built-in library function where level cab be any of the value defined in above table.
int error_reporting ( [int $level] )