SHARE

PHP IF Statement

In php if statement is used for compare and check the conditions or arguments (perimeters) . if() is a built in function in php .

Syntax

if(condition){
executable code
}

if function is started with small letters “if” ,then braces start ( and close ) , at the end curly braces are started and closed .

Uses

It is used for compare and check conditions .

Example

<?php $a=8;
if($a != 10)
{
echo "Please write the exact number";
};
?>

In this condition “if” function check the value that variable “$a”  is not equal to “10” . Condition is true ,so the code is executed and function echo the result .

if statement
if statement