I have 3 variables: $link_row & $id.
$link_row is an array of numbers and $id is a number
$link_row looks like this:
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) ...the values for the keys have different numbers at different times
$id will be a value for one of the keys in the array
I want to set the $prev variable to the value of the key before the key that corresponds with $id.
I also want to set the $next variable to the value of the key after the key that corresponds with $id.
Ex:
if $id = 2, then $prev = 1 and $next = 3.
I don't want to add/subtract with $id because the array can look like this:
Array ( [0] => 1 [1] => 2 [2] => 7 [3] => 24 )
I just want to get the value of the key before and after the key corresponding to $id.
How do I do this?
Thanks in advance for you help. I apprecaite it.