Files
php_8/arrays/rand.php

5 lines
99 B
PHP

<?php
$arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
$index = rand(0, count($arr) - 1);
echo $arr[$index];