Reverse order on output of custom values

I am pulling out values from a series of custom fields named thumb:

<?php
      $mykey_values = get_post_custom_values('preview');
      foreach ( $mykey_values as $key => $value ) {
      echo "<img src='$value' width='590'  />";
      }
?>

How do I reverse the order of the output?

Related posts

Leave a Reply

3 comments

  1. Use array_reverse.

    <?php
          $mykey_values = get_post_custom_values('preview');
          $reversed_mykey_values = array_reverse($mykey_values);
          foreach ( $reversed_mykey_values as $key => $value ) {
          echo "<img src='$value' width='590'  />";
          }
    ?>