If Condition in PHP

What is If statement?

Explanation

If structure is used for conditional execution of code segment

Syntax:


if (expr)
{
Statements
}

In the above syntax, based on the "expr" the statements are executed

Example :


<?php
if ($c > $d)
{
echo "c is bigger than d";
}
?>

In the above example, only if the condition "$c>$d" is true, the message "c is bigger than d" is displayed

PHP Topics


Ask Questions

Ask Question