How to show two different random images in PHP?

i need to show 2 different random images.
i tried this code but the second image, show the same image of the first.
i have to replicate this but with 15 random images.
http://www.kometschuh.de/Example-Random-CSS3-Image-Flip-Effect.html
for each <li> i need to show 2 different random images

<ul class="flip">
  <?php
    $all_images = glob("wp-content/themes/connexia/img-test/{*.jpg, *.JPG, *.JPEG, *.png, *.PNG}", GLOB_BRACE);

    shuffle($all_images);

    foreach ($all_images as $index => $image ) {
     if ($index == 15) break;  // Only print 15 images
     $image_name = basename($image);
     $image_name2 = basename($image++);
     echo "<li>
               <img src='/wp-content/themes/connexia/img-test/{$image_name}' />
               <img src='/wp-content/themes/connexia/img-test/{$image_name2}' />
          </li>";
    }
  ?>
</ul>

Related posts

1 comment

Comments are closed.