I try to create a variable who send a random value !
$random = mt_rand(5,10);
but i want the variable random with the number i choose like this:
$random = 5;10;15;20;25;30
The variable must send randomly 5 or 10 or 15 or 25 or 30 only
Use array_rand to pick random key from array then you can put it into an another.
http://php.net/manual/en/function.array-rand.php
$input = array(5,10,15,20,25);
$rand_key = array_rand($input);
$another_array[] = $input[$rand_key];
Assuming that you already have the values you want inside an array you can simply get a random position of the array. A rand() limited by the first element to the size of the array can solve this
<?php
$valores = [1,5,12,17,22,30,90,2,4,6]; // choose de values here
for($i=0;$i<200;$i++){ // just to print more than 1 value
echo $valores[rand(1,sizeof($valores))-1]."<br>"; // really pick the values here. start in 1 because we'll remove 1
}
while(($r=mt_rand(5,30))%5!==0);;-)