PHP Basics

PHP Error Types

While coding, or developing a PHP website or even in production stage, a website encounters. These errors could be result of wrong coding, mistake in the code, wrong implementation of code or any similar reason. PHP has list of errors that occur in a web project.

PHP Error Types

Parse Error

Parse Error also known as Syntax error. Such error occur if mistake in the code is present. PHP compiler detects such error and informs about the mistake present in the php script. After rectifying the mistake, this error vanishes.

Example:

<?php

fruit=”apple”;

echo fruit;

Output: PHP parse error Unexpected =

The variable name fruit is not defined in right manner. It must begin with $ symbol.

Fatal Error

Fatal Error occurs when a user calls a function which is either not defined or the function file path is not set properly. If PHP compiler fails to locate the function, then it throws fatal error.

Warning Error

Warning error generally occurs if the php script fails to include another file..

Notice Error

Notice error are another kind of error, which is detected by PHP Compiler because of wrong implementation of PHP guideline.

Example

<?php

$employee=”suresh’;

$age=28;

$salary=99000.00;

echo $employee_registration;

The above code will throw notice error. Because $employee_registration is not defined.