note 117734 added to function.next

From: Date: Thu, 30 Jul 2015 12:45:53 +0000
Subject: note 117734 added to function.next
Groups: php.notes 
Request: Send a blank email to php-notes+get-203221@lists.php.net to get a copy of this message
After dealing with the fact that next() will either returns FALSE when there is no further element in the array or if the element itself is FALSE, I finally find a way to do a has_next() method, which will never fails. You can ignore and/or downvote my last comment, this it will be deleted. Here is the code that work : <?php function has_next(array $a){ return next($a) !== false ?: each($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/117734 Del: integrated -- https://master.php.net/note/delete/117734/integrated Del: useless -- https://master.php.net/note/delete/117734/useless Del: bad code -- https://master.php.net/note/delete/117734/bad+code Del: spam -- https://master.php.net/note/delete/117734/spam Del: non-english -- https://master.php.net/note/delete/117734/non-english Del: in docs -- https://master.php.net/note/delete/117734/in+docs Del: other reasons-- https://master.php.net/note/delete/117734 Reject -- https://master.php.net/note/reject/117734 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203221) next »