Ik ben bezig om een wereldgenerator te maken in php maar zodra ik de textuur van een bepaalde locatie probeer op te halen, krijg ik een foutmelding. Notice: Undefined offset: 5 in C:\xampp\htdocs\Tutorial\validate.php on line 39.
Dit is mijn code:
<!-- php mapmaking -->
<?php
$x = 0;
$y = 0;
$x_max = 10;
$y_max = 12;
$texture = array("grass","sand","water","ice","lava");
?>
<html>
<table name = "world" border = 1>
<?php
while($y < $y_max) {
echo("<tr>");
while($x < $x_max) {
echo("<td>");
$field_texture[$x][$y] = $texture[rand(0,4)];
echo($field_texture[$x][$y]);
echo("</td>");
$x++;
}
$x = 0;
echo("</tr>");
$y++;
echo($field_texture[1][5]);
}
?>
</table>
</html>