Getting a random result from foreach loop then doing foreach on the random results
<p>I am trying to do a foreach loop on an array of users then randomly select 1 user from every 5 and do a foreach loop again with the results to display there user id's, the following works up until the point of the second foreach which throws up an error, can anyone please advise on what I am doing wrong.</p>

<p>Thanks in advance.</p>

<pre><code>$eligable_users = get_users(array(

  'meta_key' =&gt; 'eligable',
  'meta_value' =&gt; '0'

));


$user_chunks = array_chunk($eligable_users, 4);

foreach($user_chunks as $individual_user_chunk) {

    $random_result = array_rand($individual_user_chunk ,1);

    foreach($random_result as $user) {
        echo $user-&gt;ID . "&lt;/br&gt;";
    }

} 
</code></pre>