src/Str.php
public function position(string $needle, int $offset = 0): int
    {
        $position = \mb_strpos($this->value, $needle, $offset, (string) $this->encoding());

        if ($position === false) {
            throw new SubstringException(\sprintf(
                'Substring "%s" not found',
                $needle
            ));
        }

        return (int) $position;
    }
public function position(string $needle, int $offset = 0): int
    {
        $position = \mb_strpos($this->value, $needle, $offset, (string) $this->encoding());

        if ($position === false) {
            throw new SubstringException(\sprintf(
                'Substring "%s" not found',
                $needle
            ));
        }

        return (int) $position;
    }
public function position ( string $ needle , int $ offset = 0 ) : int { $ position = \ mb_strpos ( $ this -> value , $ needle , $ offset , ( string ) $ this -> encoding ( ) ) ; if ( $ position === false ) { throw new SubstringException ( \ sprintf ( 'Substring "%s" not found' , $ needle ) ) ; } return ( int ) $ position ; }
Returns the position of the first occurence of the string

@param string $needle
@param int $offset

@throws SubstringException If the string is not found

@return int
Returns the position of the first occurence of the string