jeudi 9 avril 2015

PHP how to get a random number that is different from values of an array

Example: I have an array with 3 values:



0 = 1
1 = 4
2 = 5


I want to get a random number like



$random = rand(1, 5);


But I need to get a number that is different from the array values. I need it to return 2 or 3.





Aucun commentaire:

Enregistrer un commentaire