php if ? : code example
Example 1: php if else
<?php
if ($a > $b) {
echo "a is bigger than b";
} elseif ($a == $b) {
echo "a is equal to b";
} else {
echo "a is smaller than b";
}
?>
Example 2: php if
<?php
if ($a > $b) {
echo "a is bigger than b";
$b = $a;
}
?>
Example 3: php if
<?php
if ($a > $b)
echo "a is bigger than b";
?>
Example 4: if statement php
if (condition) {
expression
}