> Arithmetic operations could also involve auto-increment or auto-decrement
> Let's see an example of auto-increment & auto-decrement.
echo 'auto incrementing 20 by 1 ='.$a;
echo 'auto decrementing 20 by 1 ='.$b;
echo 'auto incrementing 20 by 1 ='.$c;
echo 'auto decrementing 20 by 1 ='.$d;
> In this example, if you add two addition signs (++) to an already assigned variable, it gets incremented once when the script is run for the first time.Also adding a double subtraction (--) sign after a variable, it reduces its value by 1 when running the script for the first time.
> The same result is obtained if you put an arithmetic operator after an already assigned variable followed by an equal sign then value by which you are operating to the variable, i.e. += 1 as seen above.
You will get Output on browser as shown below;
auto incrementing 20 by 1 =21 auto decrementing 20 by 1 =19 auto incrementing 20 by 1 =21 auto decrementing 20 by 1 =19
> These are used to provide conditional, equality or alternative logics such as OR, AND and Equal.
Compares if values provided are equal
Compares if first value is greater than second
Compares if first value provided is less than the second
Greater or equal
Compares if first value is greater or equal to the second value
Less or equal
Compares if the first value provided is less than or equal to the second value
This is a certain condition that first value must not equal the second value in order for a certain code to be executed
Checks if one of the provided conditions has been fulfilled before carrying out something
Checks if all the provided conditions have been fulfilled before executing some code
Equal data type
Checks if the data type of a variable is equal to the second compared value or variable
> We will see the functionality of these logical operators when discussing the
If ... else statements and loops in our next tutorials.