<?php /**/ ?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
    <title>helloworld3.php</title>
  </head>
  <body>
  <?php
    echo "<p>", "Hello World", "</p>";
    # get the factorial parameter if it exists
    if (isset($_GET['factorial'])) {
      $n = $_GET['factorial'];
    } else {
      $n = 20;
    }
    echo "<p>Now I will calculate <b>{$n}!</b></p>";  # note use of {} to embed a variable.
    $fac = 1;
    for ($i=1; $i <= $n; $i++) {  # notice the C-style loop
       $fac = $fac*$i;
       echo "{$i}! = {$fac}<br>";
    }
  ?>
</body>
</html>
