PHP Error - online php - Phptpoint.com

PHP Error

PHP Summer Training/Internship with 2 Live Projects in Noida Fee is only 5500/-Click here to Book Your Seat.

/ins>

Types of errors in PHP

error is unwanted error unexpected behavior of a program.

error can be of two types :
Syntax error :if there is any missing symbol or extra symbol the it is said to be error in syntax.

Logical error :if there is any error in logic of a program like divide by zero or object is called but not declared then it is called logical error.

There are 3 types of error
1) notices error
2) warning
3) fatal error

Notice : In notices error if any variable is not declared but it is used at some point then it will show an notice error. Notice error can hides using “@” before $ Sign.

Output
Sum = 5050
Notice : if you are using XAMPP server your output will apper Sum = 5050 because notice error disabled appear in XAMPP server and if you are using WAMP server it shows your output lik Sum = 5050 and also a notice error for $sum variable

Warning error

Warning : if there is still a mistake in program but output is obtained . this type of error is called warning error.
It is not a critical error because it doesn’t terminate the program.
warning error arises due to two conditions:
a) if we are passing wrong type of parameters in parametrized function.
b) if we are calling a external PHP file using include function and file doesn’t exist then warning error showed.

Output

Warning: include(header.php) [function.include]: failed to open stream: No such file or directory in C:xampplitehtdocs18-06loopsum.php on line 2

Warning: include() [function.include]: Failed opening ‘header.php’ for inclusion (include_path=’.;C:xampplitephpPEAR’) in C:xampplitehtdocs18-06loopsum.php on line 2
Sum = 5050

Fatal error

Fatal error : fatal error is a critical error and it terminates the script immediately.
fatal error comes if we calling external file using require() function and file doesn’t exist then showed warning and fatal.

Output

Warning: require(header.php) [function.require]: failed to open stream: No such file or directory in C:xampplitehtdocs18-06loopsum.php on line 2

Fatal error: require() [function.require]: Failed opening required ‘header.php’ (include_path=’.;C:xampplitephpPEAR’) in C:xampplitehtdocs18-06loopsum.php on line 2

Notice : we can handle/hide all the above types of error using error_reporting(1) function.

Keep Updating yourself