The Optional Else Command in PHP
The else
construct is not mandatory.
In the following example, the text will be displayed only if
the variable value is equal to 1
.
Otherwise, nothing will happen:
<?php
$test = 1;
if ($test == 1) {
echo '+++';
}
?>
If the variable $test
is equal to 10
,
then the word 'верно'
should be displayed on the screen.
Otherwise, nothing should happen.