public static function startsWith($string, $with, $caseSensitive = true)
    {
        if (!$bytes = static::byteLength($with)) {
            return true;
        }
        if ($caseSensitive) {
            return 0 === strncmp($string, $with, $bytes);
        } else {
            return mb_strtolower(
                    mb_substr($string, 0, $bytes, '8bit'),
                    self::getCharset()
                ) === mb_strtolower($with, self::getCharset());
        }
    }
public static function startsWith($string, $with, $caseSensitive = true)
    {
        if (!$bytes = static::byteLength($with)) {
            return true;
        }
        if ($caseSensitive) {
            return 0 === strncmp($string, $with, $bytes);
        } else {
            return mb_strtolower(
                    mb_substr($string, 0, $bytes, '8bit'),
                    self::getCharset()
                ) === mb_strtolower($with, self::getCharset());
        }
    }
public static function startsWith ( $ string , $ with , $ caseSensitive = true ) { if ( ! $ bytes = static :: byteLength ( $ with ) ) { return true ; } if ( $ caseSensitive ) { return 0 === strncmp ( $ string , $ with , $ bytes ) ; } else { return mb_strtolower ( mb_substr ( $ string , 0 , $ bytes , '8bit' ) , self :: getCharset ( ) ) === mb_strtolower ( $ with , self :: getCharset ( ) ) ; } }
Check if given string starts with specified substring.
Binary and multibyte safe.

@param string $string        Input string
@param string $with          Part to search
@param bool   $caseSensitive Case sensitive search. Default is true

@return bool Returns true if first input starts with second input, false otherwise
Check if given string starts with specified substring . Binary and multibyte safe .