I want to generate 2d array with 20 cols and 20 rows with random numbers 0 and 1 and print it into table. Array should represent a table, when it is 0 that there is nothing on the table and when the value is 1 there is something on the table.
but when i try this:
public $md_pole =array([0],[19]) ;
public function vypln($md_pole)
{
$md_pole = range(0, 1);
srand((double)microtime() * 1000000); ?>
<body>
<table>
<tbody>
<?php
for ($col = 0; $col <= 19; $col++) { shuffle($md_pole);
?>
<tr>
<?php for ($row = 0; $row <= 19; $row++) {shuffle($md_pole); ?>
<td><?php echo $md_pole[$row];?></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</body>
<?php
}
Then it is with two cols and 19. Could someone help me with it?
Aucun commentaire:
Enregistrer un commentaire