Hello everybody,
In an earlier post I created an bingocard with random numbers. The card should have 6 rows and 6 columns.
I get 6 rows and 10 columns.
I am trying to adjust the columns, but with my script now it prints on each row the first number till the last number of the card 3 times.
I can't solve the problem, somewhere I make a mistake but can't figure out where.
Could someone help?
<html>
<body>
<?php
mt_srand((double)microtime()*1000000);
//Een bijzondere aanpak voor het vullen
function Vullen()
{
$getallen = array(0,1,2,3,4,5,6,7,8,9);
shuffle($getallen);
return $getallen;
}
$getallen = Vullen();
//De functie display is om de getallen aan de rijnummers te koppelen: dus 1 + 0 t/m 9 voor rij 1 en 2 + 0 t/m 9 voor rij twee etc
function display($getallen){
$table = '<table border="1px" cellpadding="1px">';
$bingokaart = array();
for ($row = 1; $row < 7; ++$row){
$bingokaart[$row] = array();
$table .= '<tr>';
//Hier print je de getallen en de rijen : Echter nu 6 rijen en 10 columns!
foreach ($getallen as $number){
//for rownumber? Here it goes wrong? Now it prints on each row three times the number
for ($rownumber = 0; $rownumber < 3 ; ++$rownumber ){
$bingokaart[$row] = $row .$number;
$table .= '<td>' . $bingokaart[$row] . '</td>';
}
}
$table .= '</tr>';
}
$table .='</table>';
echo $table;
}
display($getallen);
?>
</body>
</html>