The If statementThe syntax of If statement is:
if (conditions) {
//do something
}else{
//do other thing
}
For example:
<?php
if($name == "zhou") {
echo "Welcome $name!";
} else {
echo "Sorry, you are not authorized
to access this page.";
}
?>
You can use "if ...elseif ... else" to add more condition statements.
There are many different comparison operators that are the foundation
for building our conditionals, and they are listed below:
$a == $b |
$a is equal to $b |
$a != $b |
$a is not equal to $b |
$a < $b |
$a is less than $b |
$a > $b |
$a is greater than $b |
$a <= $b |
$a is less than or equal to $b |
$a >= $b |
$a is greater than or equal to $b |
|