Errors will occur for following reason in php:
1.unclosed quotes,
2.missing semicolon,
3.missing parentheses,
4.add extra parentheses,
5.unclosed braces,
6.undefined variable,
7.call undefined function,
8.includes files which is not found
Basically four types errors is occurred in php. There are:
The parse errors php is the syntax error. It stops the execution of the script in php. The common reasons for occur parse in php as follows:
where the closing brace is missed. When you run this file, you'll get error message like below:
The fatal error will occur when you call the undefined function in php. It stop the execution of the php script.
where the function "place()" is not defined. But you call that function. Now it gives the fatal error like below:
The warning is occurred when you include the file but the file is not found in php. It does not stop the execution of the php script.
where, the file welcome.php is not found but you include it. So you'll get output like this:
The noticed error is occurred when you use undefined variable. It does not stop execution of the php script.
where $guru is not defined but you accessed. So you'll get error message like this:
1.unclosed quotes,
2.missing semicolon,
3.missing parentheses,
4.add extra parentheses,
5.unclosed braces,
6.undefined variable,
7.call undefined function,
8.includes files which is not found
Common errors in php:
Basically four types errors is occurred in php. There are:
1. Parse error
2. Fatal error
3. Warning
4. Noticed error
Parse error:
The parse errors php is the syntax error. It stops the execution of the script in php. The common reasons for occur parse in php as follows:
1.unclosed quotes
2.missing semicolon
3.unclosed braces
4.missing parentheses
5.add extra parentheses
Consider the following example in php:
where, the quotes are not closed. When you run this file, you'll get error message like this:
where, the semicolon is missing at $name. It gives the parse error like below:
2.missing semicolon
3.unclosed braces
4.missing parentheses
5.add extra parentheses
Parse error by unclosed quotes in php:
Consider the following example in php:
<?php
$name='guru;
echo $name;
?>
$name='guru;
echo $name;
?>
where, the quotes are not closed. When you run this file, you'll get error message like this:
Parse error by missing semicolon in php:
Consider the following example:
<?php
$name='Guru'
echo $name;
?>
$name='Guru'
echo $name;
?>
where, the semicolon is missing at $name. It gives the parse error like below:
Parse error by unclosed braces in php:
<?php
$a=5;
$b=6;
if($a==$b)
{
echo 'equal';
else
{
echo'Not equal';
}
?>
where the closing brace is missed. When you run this file, you'll get error message like below:
Fatal error in php:
The fatal error will occur when you call the undefined function in php. It stop the execution of the php script.
<?php
function name($str)
{
echo $str;
}
echo place('guru');
?>
where the function "place()" is not defined. But you call that function. Now it gives the fatal error like below:
Waring in php:
The warning is occurred when you include the file but the file is not found in php. It does not stop the execution of the php script.
<?php
include('welcome.php');
echo'welcome';
?>
where, the file welcome.php is not found but you include it. So you'll get output like this:
Noticed error in php:
The noticed error is occurred when you use undefined variable. It does not stop execution of the php script.
<?php
$name='Guru';
echo $guru;
?>
where $guru is not defined but you accessed. So you'll get error message like this: