If Statements

If statements allow you to compare variables and if your comparison is true it will run code.
if($variable == $variable2) { CODE TO EXECUTE IF VARIABLE IS EQUAL TO VARIABLE2 }

Types of Comparisons

There are many differnt types of comparisons you can put in your if statement:

== - Is equal to
!= - Is not equal to
< - Less then
> - Greater then
<= - Less than or equal to
>= - Greater than or equal to

You use two equal signs istead of one to check if two variables are equal because one equal sign sets a variable equal to something. So the creators of PHP made two equal signs check to see if they were the same.

And & Or

You may want to check if two conditions are true or if one or the other is true.
if($v == $v2 || $v != $v2) { CODE TO EXECUTE }

This will check to see if $v is equal to $v2 OR if $v is not equal to $v2. In the case the code will run either way. You can also make sure two conditions are true before running code:
if($v == $v2 && $v == 1) { CODE TO EXECUTE }

This code will check to see if $v is equal to $v2 AND if $v is equal to one.

Go to loops>>