Is it possible to find the last occurrence of a value in an array element starting at a specific index value. I have found a partial solution in this post [How can I find the key of the last occurrence of an item in a multidimensional array? but it doesn't allow for starting at a specific index. I am looping thru an array matching an 'id' number. If the 'id' number doesn't exist in the current array index, I would like to search back from that point finding the last occurrence of that value.
$last = "";
foreach($arr as $key => $array) {
if ( $array['id'] === $id) {
$last = $key;
}
}
echo $last."\n\n";