PHP - Loops and Printing

The For Loop

<body>
Ordinary html<br />
<? for ($i=1; $i<=10; $i++)
          {echo " Count: $i";}
?>
</body>

While Loop

$count=1;
while ($count<=5) {
       echo "Counting: $count<br />";
       $count++;
}

DO While Loop

do {
    echo "Counting: $count<br />";
    $count++;
} while ($count<=5);

If Statements

The syntax is similiar to perl and javascript

if (x==5)
   {true}
else {false};

Echo vs Print

Why use Echo instead of Print

Echo allows several arguments separated by commas, Print doesn't

Print an Array

$arraystring=implode($array," ");
print $arraystring;

displays a long string of elements separated by a space