Use array count in PHP exercise.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-11-10 20:45:21 +01:00
parent 153f2f8659
commit 01e65c1fce

View File

@ -10,6 +10,6 @@ $imgs[0] = "imgs/img0.jpg";
$imgs[1] = "imgs/img1.jpg";
$imgs[2] = "imgs/img2.jpg";
?>
<img src="<?= $imgs[rand(0, 2)] ?>" />
<img src="<?= $imgs[rand(0, count($imgs)-1)] ?>" />
</body>
</html>