note 124173 added to function.next
| From: | Mikhail@php.net | Date: | Thu, 05 Sep 2019 14:47:30 +0000 |
| Subject: | note 124173 added to function.next | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212101@lists.php.net to get a copy of this message | ||
This function returns next element in array after your key or false if it last or key doesn't
exists in array.
<?php
function nextElement(array $array, $currentKey)
{
if (!isset($array[$currentKey])) {
return false;
}
$nextElement = false;
foreach ($array as $key => $item) {
$nextElement = next($array);
if ($key == $currentKey) {
break;
}
}
return $nextElement;
}
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.168 (proxied: 82.112.186.162)
----
Manual Page -- http://php.net/manual/en/function.next.php
Edit -- https://master.php.net/note/edit/124173
Del: integrated -- https://master.php.net/note/delete/124173/integrated
Del: useless -- https://master.php.net/note/delete/124173/useless
Del: bad code -- https://master.php.net/note/delete/124173/bad+code
Del: spam -- https://master.php.net/note/delete/124173/spam
Del: non-english -- https://master.php.net/note/delete/124173/non-english
Del: in docs -- https://master.php.net/note/delete/124173/in+docs
Del: other reasons-- https://master.php.net/note/delete/124173
Reject -- https://master.php.net/note/reject/124173
Search -- https://master.php.net/manage/user-notes.php