PHP code example of mlavrk / array-random-value
1. Go to this page and download the library: Download mlavrk/array-random-value library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mlavrk / array-random-value example snippets
$array = [1, 2, 3, 4, 5];
$randomValue = array_random_value($array);
echo $randomValue; // Outputs a random value from the array, e.g., 3