/** * Will get the next item and loop within the array if applicable * @param array Array to search. * @param currentItem Item to search. * @return * */ public static function get_next_item($array, $currentItem) { $currentIndex = array_search($currentItem, $array); $nextIndex = ArrayUtils::get_next_index($array, $currentIndex, true); return $array[$nextIndex]; }