I don't manage to add a navigation arrow to my portfolio. I would like to get next and prev id based on current id. The issue is when the $current_id is the last of array, I don't know how to go to the first one to create a kind of loop. And the same if the $current_id is the first element, how to have the last element as prev ? I'm stuck, can you please help me ?
Here is my code:
<?php
$current_id = "10";
$array = array(
"1" => "aa",
"2" => "bb",
"3" => "cc",
"4" => "dd",
"5" => "ee",
"6" => "ff",
"7" => "gg",
"8" => "hh",
"9" => "ii",
"10" => "jj",
);
$current_index = array_search($current_id, $array);
$next = $current_index + 1;
$prev = $current_index - 1;
?>