samedi 7 septembre 2019

How to get random index of minimum values from an array in PHP

I've an array like this:

$a[0] = 2;
$a[1] = 7;
$a[2] = 5;
$a[3] = 2;
$a[4] = 2;
$a[5] = 3;

I want to get random index of only minimum values in this array.
In above array the function should return either 0 or 3 or 4 because 2 is the only minimum value in this array.




Aucun commentaire:

Enregistrer un commentaire