note 69092 deleted from function.reset by bjori
| From: | bjori@php.net | Date: | Wed, 23 Aug 2006 07:39:40 +0000 |
| Subject: | note 69092 deleted from function.reset by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116207@lists.php.net to get a copy of this message | ||
Note Submitter: dionyziz at deviantart.com
----
alreece45 at yahoo dot com's each() did not work in my tests. I had to check the return value
of current(), instead.
<?php
function rotate(&$array) {
$item = current($array);
if ($item === false) {
reset($array);
$item = current($array);
if ($item === false) {
// array is empty
return false;
}
}
return $item;
}
?>