Using Endwhile PHP (Codeacademy)

This is quite easy:

1
2
3
4
5
6
7
8
9
10
<?php
	//Add while loop below
    $number = 3;
    while ($number < 10):
 
            echo $number;
            $number++;
    endwhile;
 
    ?>

Notice the small differences in syntax. It is similar with “switch” where you add endswitch; at the end, instead of closing with curly brackets.
You usually don’t use this syntax but it’s good to know about it.

ADD A COMMENT: