Lesson 6.1 works but it shouldn't


I think the logic in lesson 6.1 is incomplete. It shouldn't work, but it does, only on codecademy though. When I copy and paste the code and run it on a php page on a different server it doesn't run. I suspected this would be the case, which is why I did that.

The if statement on lines 15-17 doesn't test for any condition. To be a valid if statement, doesn't it have to test to see IF something is true or not?
The code:

$flip = rand(0,1);

/*  then later as part of a loop . . .  */

if ($flip){
        $headCount ++;
        echo "<div class=\"coin\">H</div>";


To me this reads in plain English =
Assign the value of either 0 or 1 randomly to $flip.
If flip ____________ increase the value of the $headcount by one and write some HTML to the screen.

See the big blank there?

Am I missing something?


I get it. The first line quoted above sets the value of $flip to 1 or zero, true or false, null or not, etc...

so the blank in my if statement is actually not a blank. it could be replaced "exists" or is not null. etc. . . .