Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dvprog_06_2 [2017-09-22 10:29]
Daniel Viström
dvprog_06_2 [2020-05-18 20:24]
Daniel Viström
Line 2: Line 2:
  
 Gör en tabell som skriver ut tal 1 - 100 i en tabell med tio tal på varje rad. Gör en tabell som skriver ut tal 1 - 100 i en tabell med tio tal på varje rad.
 +
 +{{:tabell100.jpg?400|}}
  
 <code php> <code php>
 <?php <?php
-include('head.php')+include 'head.php'; 
- + 
 +echo '<table>';
 $i = 0;  //Tiotal $i = 0;  //Tiotal
-echo '<table>'; 
 while ($i < 10){    // Loopa $i från 0 - 9 while ($i < 10){    // Loopa $i från 0 - 9
   echo '<tr>';      // Ny rad   echo '<tr>';      // Ny rad
   $j = 1;           // Ental   $j = 1;           // Ental
-  while ($j < 11){  // För varje värde på $i loopas $j från 1 - 10.+  while ($j < 11){  // För varje värde på $i loopas $j från 1 - 10
     $ut = $i * 10 + $j;      $ut = $i * 10 + $j; 
-    echo '<td>' . $ut . '</td>';  // En cell för varje varv i loopen.+    echo '<td>' . $ut . '</td>';  // En cell för varje varv i loopen
     $j++;     $j++;
   }   }
Line 22: Line 24:
 echo '</table>'; echo '</table>';
    
-include('foot.php'); +include 'foot.php';
-?>+
 </code> </code>