title: Creating an array from values in a Wordpress loop
body: <p>I have tried to work this out and looked for a solution but no luck.</p>
  
  <p>My wordpress loop looks like this...</p>
  
  <pre><code>$args = array(
      'post_type'=&gt; 'reviews',
      'meta_key' =&gt; 'post_id',
      'meta_value' =&gt; $pageid,
      'paged' =&gt; $paged,
      'posts_per_page' =&gt;20,
      'orderby' =&gt; rand
  );
  query_posts( $args );
  if (have_posts()) :while (have_posts()) : the_post();
  </code></pre>
  
  <p>Each post has a custom field called 'rating' which contains a number between 1 and 5.</p>
  
  <p>What I want to do is create an array form the value of 'rating' for all posts in the loop... to look something like this...</p>
  
  <pre><code>$ratings=array("5","4","2","5","3","5");
  </code></pre>
  
  <p>So that I can then calculate the median value.</p>
  
  <p>Thanks in advance for any help.</p>