My php is rusty, I am trying to get a PHP code to return a different user ID’s added to the following array from an array of possible users.
'online_users' => array(54)
'bots_ids' => array(153,122,173,124,173,132,184,188)
I want to pick and a add random bot every 1-5 hours after which he will be replaced by another bot or just deleted (not all bots have to be online simutaniously)
I tried setting the seed to the current hours divided by a random number but it doesn’t seem to work.
Thanks in advance!
I think you are looking for a array_rand() in this case. It will select up to N random keys out of the array and place them in their own array. This will let you do what you’re looking to do .
As for the 2nd part of the question, you can setup cron to execute the script at every hour that would trigger the change. Alternatively, to Online/Offline List you can just have a common pool of bots that gets randomly picked every hour.