Commit:    eb43798de4660bfd79f2c57683e21c523740933d
Author:    Hannes Magnusson <[email protected]>         Fri, 22 Nov 2013 
00:35:00 -0800
Parents:   918d1a81257c839792495380d503181b425fd7f1
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=eb43798de4660bfd79f2c57683e21c523740933d

Log:
Have a fixed limit here, and remove endless count()s

Changed paths:
  M  images/elephpants.php


Diff:
diff --git a/images/elephpants.php b/images/elephpants.php
index 4054853..3375f9d 100644
--- a/images/elephpants.php
+++ b/images/elephpants.php
@@ -46,10 +46,10 @@ if (!$photos || !is_array($photos)) {
 // prepare requested number of elephpants at random.
 shuffle($photos);
 $elephpants = array();
-foreach ($photos as $photo) {
+foreach ($photos as $n => $photo) {
 
     // stop when we have the requested number of photos.
-    if (count($elephpants) == $count) {
+    if ($n == $count || $n > 20) {
         break;
     }


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to