public static function beginsWith(
        string $haystack,
        string $needle,
        bool $caseSensitive = false
    ): bool
    {
        $length = strlen($needle);
        return ($caseSensitive === false)
            ? strncasecmp($haystack, $needle, $length) === 0
            : strncmp($haystack, $needle, $length) === 0;
    }
public static function beginsWith(
        string $haystack,
        string $needle,
        bool $caseSensitive = false
    ): bool
    {
        $length = strlen($needle);
        return ($caseSensitive === false)
            ? strncasecmp($haystack, $needle, $length) === 0
            : strncmp($haystack, $needle, $length) === 0;
    }
public static function beginsWith ( string $ haystack , string $ needle , bool $ caseSensitive = false ) : bool { $ length = strlen ( $ needle ) ; return ( $ caseSensitive === false ) ? strncasecmp ( $ haystack , $ needle , $ length ) === 0 : strncmp ( $ haystack , $ needle , $ length ) === 0 ; }
Determine if a string begins with another

@param string $haystack
@param string $needle
@param bool $caseSensitive
@return bool
Determine if a string begins with another