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>
|
<h1><?= $num_dice ?> dados</h1>
|
||||||
<?php
|
<?php
|
||||||
$rolls = [];
|
|
||||||
$max = -1;
|
$max = -1;
|
||||||
for($i = 0; $i < $num_dice; $i++) {
|
for($i = 0; $i < $num_dice; $i++) {
|
||||||
$rolls[$i] = rand(1,6);
|
$roll = rand(1,6);
|
||||||
if($rolls[$i] > $max)
|
if($roll > $max)
|
||||||
$max = $rolls[$i];
|
$max = $roll;
|
||||||
?>
|
?>
|
||||||
<img src="imgs/<?= $rolls[$i] ?>.svg" />
|
<img src="imgs/<?= $roll ?>.svg" />
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user