Required:
- Basic understanding of Variables
- Basic understanding of PHP
- Basic understanding of Geometry or Algebra.


What is an If statement?

If statements in PHP are basically the same thing as in Geometry.

Code:
If this is that, then let everyone know.
PHP Code:
if($This == $That){
 echo 
"This is that.";

Now as you can see it is rather similar, if statements are in almost every code created due to the fact they allow us to "Process" data easily.

I shall now go a bit in depth with the structure of an if statement.

The actual statement;

if($This == $That)

What is happening?

If this equals that.

We use double == to express that both variables must be equal to allow us to continue into the then area.


if($This == $That){

What is happening?

If this equals that, then.

The opening bracket allows us to "Nestle" all the code into one area (Once you get more advanced you will learn other ways to do this.)


if($This == $That){
echo "This is that.";

What is happening?

The echo code is inside the Nestle meaning that if $This == $That then it should echo the String.


if($This == $That){
echo "This is that.";
}

What is happening?

The closing bracket allows us to limit what codes can only be executed if the statements requirements are met.


Now this is only a basic idea of how if statements work, there are more things that should be added but with my time this is all I could offer.

I hope this helped you in some way.