php if statement

The PHP if statement is very similar to if statement in java , c,c++,other programing languges.If a specified condition is true, The IF statement to execute some code only otherwise program execution will be complete.

If statement syntax

<?php
if (condition)
{
------------ ( True part )
------------
------------
}
?>

If condition is TRUE program will execute True part otherwise program will be ignore. condition is evaluated to its Boolean value

Here is one simple example of if statement.

php if example :


<?php
if ($a > $b)
echo "a is bigger than b";
?>

The above example would display a is bigger than b if $a is bigger than $b.otherwise program execution time will be complete.





Content