Skip to content

Instantly share code, notes, and snippets.

@shatko
Last active September 20, 2015 18:57
Show Gist options
  • Save shatko/fd6634343e97ed9499a7 to your computer and use it in GitHub Desktop.
Save shatko/fd6634343e97ed9499a7 to your computer and use it in GitHub Desktop.
function getNextFactId($currentId, $EveryCroid) {
reset($EveryCroid);
while (!in_array(current($EveryCroid), [$currentId, null])) {
next($EveryCroid);
}
$nextFactId = next($EveryCroid);
if ($nextFactId > end($EveryCroid)) {
$$nextFactId = reset($EveryCroid);
}
return $nextFactId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment