public function indexOf(array $array, $searchElement, $fromIndex = null): int
    {
        if ($fromIndex !== null) {
            $array = array_slice($array, $fromIndex, null, true);
        }
        $result = array_search($searchElement, $array, true);
        if ($result === false) {
            return -1;
        }
        return $result;
    }