title: wordpress nested foreach loop
body: <p>i currently have a foreach within a foreach, ehre is my code:</p>
  
  <pre><code>$blogusers = get_users();   
  global $post;   
  $my_query =  get_posts('showposts=-1&amp;post_type=friend_requests&amp;post_status=publish');
  //query_posts(array('showposts' =&gt; -1, 'post_type' =&gt; 'friend_requests', 'post_status' =&gt; array('publish') )); while (have_posts()) : the_post();
  
  foreach($my_query as $post) :
  
     //do stuff
  
     foreach ( $blogusers as $user ) {
  
        echo $user;
  
     }
  
  endforeach;
  wp_reset_query();
  </code></pre>
  
  <p>My issue is that depending on the amount of items in the <code>$my_query</code> array this will duplicate the output when i echo <code>$user</code>. So for example if there is 1 item in <code>$my_query</code> and 3 items in <code>$blogusers</code> the output will look like this:</p>
  
  <pre><code>User 1
  User 2
  User 3
  </code></pre>
  
  <p>However if there are 2 items in <code>$my_query</code> and 3 in <code>$blogusers</code> the output will look like this:</p>
  
  <pre><code>User 1
  User 2
  User 3
  User 1
  User 2
  User 3
  </code></pre>
  
  <p>Is there any particular reason why this is happening?</p>