note 117715 added to function.next

From: Date: Tue, 28 Jul 2015 07:11:19 +0000
Subject: note 117715 added to function.next
Groups: php.notes 
Request: Send a blank email to php-notes+get-203200@lists.php.net to get a copy of this message
As some wants to know if the array has another element after. There is an issue when the next element is FALSE, you don't know if the element is FALSE or if the function next() returns FALSE because there isn't another element. Now, you're aware of that, I have my quick "has_next", which will work if there is no FALSE value in the array. <?php function has_next(array $a){ return next($a) !== false; } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 88.186.20.115 ---- Manual Page -- http://php.net/manual/en/function.next.php Edit -- https://master.php.net/note/edit/117715 Del: integrated -- https://master.php.net/note/delete/117715/integrated Del: useless -- https://master.php.net/note/delete/117715/useless Del: bad code -- https://master.php.net/note/delete/117715/bad+code Del: spam -- https://master.php.net/note/delete/117715/spam Del: non-english -- https://master.php.net/note/delete/117715/non-english Del: in docs -- https://master.php.net/note/delete/117715/in+docs Del: other reasons-- https://master.php.net/note/delete/117715 Reject -- https://master.php.net/note/reject/117715 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203200) next »