PHP 8.5.0 Beta 1 available for testing

Voting

: six plus one?
(Example: nine)

The Note You're Voting On

JumpIfBelow
10 years ago
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;
}
?>

<< Back to user notes page

To Top