src/Str.php
public static function beginsWith($input, $search, $caseInsensitive = false, $encoding = self::DEFAULT_ENCODING)
    {
        $substr = static::sub($input, 0, static::length($search), $encoding);

        return (static::compare($substr, $search, $caseInsensitive) === 0);
    }
public static function beginsWith($input, $search, $caseInsensitive = false, $encoding = self::DEFAULT_ENCODING)
    {
        $substr = static::sub($input, 0, static::length($search), $encoding);

        return (static::compare($substr, $search, $caseInsensitive) === 0);
    }
public static function beginsWith ( $ input , $ search , $ caseInsensitive = false , $ encoding = self :: DEFAULT_ENCODING ) { $ substr = static :: sub ( $ input , 0 , static :: length ( $ search ) , $ encoding ) ; return ( static :: compare ( $ substr , $ search , $ caseInsensitive ) === 0 ) ; }
Verifies if a string begins with a substring.

Uses the multibyte function if available with the given encoding $encoding.
The comparison is case-sensitive by default.

@param string $input           The input string to compare to.
@param string $search          The substring to compare the beginning to.
@param bool   $caseInsensitive Whether the comparison is case-sensitive.
@param string $encoding        The encoding of the input string.

@return bool Returns true if the input string begins with the given search string.
@SuppressWarnings(PHPMD.BooleanArgumentFlag)
Verifies if a string begins with a substring .