0
<?php
// Define um array com alguns sites:
$site[] = 'site1.com';
$site[] = 'site2.com';
$site[] = 'site3.com';
$site[] = 'site4.com';
// Escolhe um valor aleatório (respeitando o total de sites)
$destino = rand(0, (count($site) - 1));
// Redireciona o usuario:
header("Location: " . $site[$destino]);
?>
Hello, I am using this function so that when the user accesses this php, it is redirected to one of these sites. But I wanted to do a Random inside a Random. For example: In the first option would be site1.com and site2.com. Ai in the second site3.com and site4.com option.
So that if the first option is selected randomly, the site1 or site2 would be opened randomly.
Dude, I’m kind of doubtful about the way this code works?
– RafaelMacedo
I made a more complete explanation, any doubt call blz
– CaMar
Would that be correct? http://prntscr.com/my30pt Just so you can understand. I have 5 link1s. 3 are more important and 2 less important. So I want to prioritize the 3 links I left separate and the 2 less important ones in a single space, so the 2 less important links are less likely to be seen. If you could check the code and see if it’s right, I’d really appreciate it, man.
– RafaelMacedo
In this case you will need to perform a check to see how many items there are within the group before. If it is more than one value you use Rand() and let it decide which value should be returned but if it contains only one value you return it.
– CaMar