For loops


#1

for ($a = 1; $a < 10; $a++){
echo $a;
}
basically $a++ means plus 1
This is understandable for me.
Now, if say you want to add five, why do
you have to do a $a = $a + 5;
Obviously, your assigning $a + 5 into the variable $a;
so why not just write $a + 5 instead of $a = $a + 5; since
$a is the equivalent of $a + 5;


#2

Well think of it this way.

What is $a + 5 equal to?
That is what the computer sees, it needs an assignment property to know that the ending value for the variable is being changed.

Otherwise if you did something like:

$b = $a + 5;
then are you saying that $a is adding 5 to itself? Then what's going on with $b?

While it seems like it adds an unnecessary step it's actually a lot more practical than just having "$a + 5" alone.

I hope I explained this in depth enough, and if you need me to go over it in a different way I will do so, just let me know :+1: