src/ArrayUtils.php
public static function key2offset(array &$arr, $key)
    {
        return isset($arr[$key]) ? array_flip(array_keys($arr))[$key] : false;
    }
public static function key2offset(array &$arr, $key)
    {
        return isset($arr[$key]) ? array_flip(array_keys($arr))[$key] : false;
    }
Return the array offset corresponding to an array key.
@param  Array  &$arr
@param  strin|int $key
@return int