Use array count in PHP exercise.
This commit is contained in:
parent
153f2f8659
commit
01e65c1fce
@ -10,6 +10,6 @@ $imgs[0] = "imgs/img0.jpg";
|
|||||||
$imgs[1] = "imgs/img1.jpg";
|
$imgs[1] = "imgs/img1.jpg";
|
||||||
$imgs[2] = "imgs/img2.jpg";
|
$imgs[2] = "imgs/img2.jpg";
|
||||||
?>
|
?>
|
||||||
<img src="<?= $imgs[rand(0, 2)] ?>" />
|
<img src="<?= $imgs[rand(0, count($imgs)-1)] ?>" />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user