Introduce pet-projects dir
[lcapit-junk-code.git] / pet-projects / web / timestable.php
blob9f1db68cf0975a4edef89a9bdc28da42a1066678
1 <html>
2 <body>
3 <?php
4 $nr_max_table = 10;
6 function generate_results()
8 global $nr_max_table;
10 for ($i = 1; $i <= $nr_max_table; $i++) {
11 for ($j = 0; $j <= 10; $j++) {
12 $res = $i * $j;
13 $results[$i] .= "$i * $j = $res<br/>\n";
17 return $results;
20 echo("<table border=\"1\" cellpadding=\"10\">\n");
21 echo("<tr>\n");
23 $results = generate_results();
24 for ($i = 1; $i <= $nr_max_table; $i++) {
25 echo("<td>\n");
26 echo($results[$i]);
27 echo("</td>\n");
29 // Brakes the table in the middle
30 if ($i == ($nr_max_table / 2))
31 echo("</tr>\n<tr>\n");
34 echo("</tr>\n");
35 echo("</table>\n");
37 </body>
38 </html>