Short Hand If
To write shorter code, you can write if
statements on one line.
Example
One-line if
statement:
$a = 5;
if ($a < 10) $b = "Hello";
echo $b
To write shorter code, you can write if
statements on one line.
One-line if
statement:
$a = 5;
if ($a < 10) $b = "Hello";
echo $b
The if...else
statement executes some code if a condition is true and another code if that condition is false. Continue reading PHP if…else Statements