Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Errors in PHP

    • 0
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 103
    Comment on it

    Errors are the unwanted conditions which interrupts the normal flow of the program.

    Errors can be categorized in two :

    Syntax Error : If there is any symbol missing or mistake in the statements of the program those are syntax errors.

    Logical Error : If there is any logical mistakes like divide by zero then those errors are termed as logical errors.

    In PHP there are 3 types of errors :

    1) notice error
    2) warning
    3) Fetal

    1) notice error

    The notice error occurred when a variable is not declared and it is been used at some point then the notice error is given. To avoid this error we should use the "@" in place of "$" before variable.

    for example:

    <?php
    
    for($i=1;$i<=10;$i++)
    {
        echo  $i;
    }
    
    ?>
    

    2) warning

    If there is any error and still the output is displayed then the warning is shown. These errors doesn't halt the execution of the program.

    <?php
       include('Request.php');
       echo "Hello!";
    ?>
    

    The warning that will be displayed be like
    Output Warning: include(Request.php) [function.include]: failed to open stream: No such file or directory in C:xampplitehtdocs18-06loopsum.php on line 2
    Hello

    3) Fetal

    Fetal errors are the one which terminates the execution of the program if any error occurs. these kind of errors occurs like if you are calling a file through require function and the file doesn't exists or something happens then the require() will terminate the execution and displays the error.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: