We will not treat to IF and Else
IF
IF, serves to create names veriaveis when they may or may not be altered, as it is an "if" in the same page.
It's like she check whether YES or NO.
Example:
PHP Code:
<?php
$number1 = 6; // will be the first number in our first variable
$number2 = 12; // will be our second variable.
if ($number1 < $number2){ // if 6 is less than 12
echo "True"; // if true alternative to the above, it shows a message like that.
}
?>
ELSE
The ELSE, always acts after the "if" he is how one if not.
Example:
PHP Code:
<?php
$number1 = 6; // will be the first number in our first variable
$number2 = 12; // will be our second variable.
if ($number1 < $number2){ // if 6 is less than 12
echo "True"; // if true alternative to the above, it shows a message like that.
}else{
echo "False"; // if false alternative to the above, it shows a message like that.
?>
If $number 1 is less than $number 2 shows "TRUE"
If not, shows "FALSE".
Simple, no? Good. tomorrow I'll pass on "For" and "Variable and Echo"
Goodnight and good studies!