phptabelleohneforeach.php


Quell Code


<!DOCTYPE html> 
<html lang="de"> 
<head> 
<meta charset="utf-8" /> 
<title>E1_1mal1</title> 
<style>
td,th{
width:20px;
text-align:center;
}
</style>
</head> 
    <body> 
    <h1>Das kleine 1 mal 1</h1> 
        <table> 
            <thead> 
    <?php 
                echo "<th>*</th>"; 
     
                for ($i = 1; $i <= 10; $i++) {  
                            echo "<th>"; 
                            echo $i; 
                            echo "</th>";                                      } 
                ?> 
       </thead>  
            <tbody> 
    <?php 
              
for ($i = 1; $i <= 10; $i++) { 
echo "<tr><th>$i</th>"; 
for ($j = 1; $j <= 10; $j++) { 
echo "<td>";  
echo ($i * $j); 
echo "</td>"; 
} 
echo "</tr>"; 
} 
                ?> 
                </tbody> 
        </table> 
    </body> 
</html>