Simplify code. Array not necessary.
This commit is contained in:
parent
0c0702fc77
commit
9ef5aee315
@ -9,14 +9,13 @@ $num_dice = rand(1,10);
|
||||
?>
|
||||
<h1><?= $num_dice ?> dados</h1>
|
||||
<?php
|
||||
$rolls = [];
|
||||
$max = -1;
|
||||
for($i = 0; $i < $num_dice; $i++) {
|
||||
$rolls[$i] = rand(1,6);
|
||||
if($rolls[$i] > $max)
|
||||
$max = $rolls[$i];
|
||||
$roll = rand(1,6);
|
||||
if($roll > $max)
|
||||
$max = $roll;
|
||||
?>
|
||||
<img src="imgs/<?= $rolls[$i] ?>.svg" />
|
||||
<img src="imgs/<?= $roll ?>.svg" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user