PHP Tutorial – Part 2 – Info PHP

You can read the previous of the series:

About php.ini file

The php.ini file is basically the configuration file and is an important file. For now it is important to handle an error. Firstly, I will tell where it is situated. The address of this file is C:xamppphp and in this directory the file is named as php.ini-Development. Maybe extra file php.ini-Production exists, but open the development file with notepad.

  1. Open the php.ini file with notepad.
  2. Search for error_reporting.

  3. May be it is set to 0.

    error_reporting = 0

  4. Correct it as shown in picture.

    error_reporting = E_ALL

Why?

As I said at the starting of this that it is useful for handling the error.

If it is set to E_ALL Browser show an error you make in program or code. When we develop any website it is very useful for handling error. But when a user uses or see the website it is not good to see errors in the webpage.

When it is set to error_reportion= 0 Then a user will not see any error on the page he will see whatever runs on the website. User will not know about errors.

It is good to change, when the website is being developed to E-ALL , and after b developed to 0.

and there are many arguments for the error_reporting You can check it form the php.ini file description of all condition is given in it

error_reporting

If else statement

Note: if you have the knowledge of other programming languages (like Java etc.), then there is no need to read about next articles.

If statement

The syntax for if statement is:

If, if occurs at any place in code then the  statements written after if the condition that is after if in the bracket “()” is true.

If else statement

The syntax of if else statement is:

    If(condition){
       //true
       Execute the statement;
    }
    else{
       //when condition is not true
       Execute the statement;
    }

If the if is not executed, then the else will get executed.

Nested if else condition is nothing but the nesting of if else conditions like this:

    If(condition){ //outer if
       If(condition){ //inner if
          statement1 ;
       }
       Else{ //inner else
          statement2;
       }
       Else{ //outer else
          statement3;
    }

In this syntax there are two if else statements in it. Firstly, it is the outer if else statement and another is inner if else statement. When the condition of outer if and inner if is true then the statement1 executes. If the outer one is true and inner if is false, then inner else is executed. It is same for the next conditions.

We can write it in a different way:

    If(condition1){
       Statement1;
    }
    Elseif(condition2){
       Statement2;
    }
    Elseif(condition3){
       Statement3;
    }
    Else{
       Statement4;
    }

Note-

Article Prepared by Ollala Corp

You might also like
Leave A Reply

Your email address will not be published.