src/Bag.php
public function lastIndexOf($item, $fromIndex = null)
    {
        foreach ($this->iterateReverseFromIndex($fromIndex) as $key => $value) {
            if ($value === $item) {
                return $key;
            }
        }

        return null;
    }
public function lastIndexOf($item, $fromIndex = null)
    {
        foreach ($this->iterateReverseFromIndex($fromIndex) as $key => $value) {
            if ($value === $item) {
                return $key;
            }
        }

        return null;
    }
Gets the last index/key of a given item.

This uses a strict check so types must much and objects must be the same instance to match.

@param mixed $item      The item to search for
@param int   $fromIndex The starting index to search from. Default is the last index.
Can be negative to start from that far from the end of the array.
If index is out of bounds, it will be moved to first/last index.

@return int|string|null The index or key of the item or null if the item was not found