Kann mir jemand das in PHP in schleifen und Array programmieren?
Danke im voraus!
Danke im voraus!
$x = 10;
$y = 10;
$spielstand = array();
for($i = 0; $i < $x; $i++) {
$temp = array();
for($j = 0; $j < $y; $j++) {
array_push($temp, rand(0, 50));
}
array_push($spielstand, $temp);
}
echo "<table border='1'>";
for($i = 0; $i < sizeof($spielstand); $i++) {
echo "<tr>";
for($j = 0; $j < sizeof($spielstand[$i]); $j++) {
echo "<td>" . $spielstand[$i][$j] . "</td>";
}
echo "<tr>";
}
echo "</table>";
$x = 10;
$y = 10;
$spielstand = array();
for($i = 0; $i < $x; $i++) {
$temp = array();
for($j = 0; $j < $y; $j++) {
array_push($temp, rand(0, 50));
}
array_push($spielstand, $temp);
}
echo "<table border='1'>";
for($i = 0; $i < sizeof($spielstand); $i++) {
echo "<tr>";
for($j = 0; $j < sizeof($spielstand[$i]); $j++) {
echo "<td>" . $spielstand[$i][$j] . "</td>";
}
echo "<tr>";
}
echo "</table>";
Kommentar