public static function startsWith(string $haystack, string $needle, bool $caseSensitive = true)
    {
        if ($caseSensitive) {
            return $needle === '' || strpos($haystack, $needle) === 0;
        }

        return $needle === '' || stripos($haystack, $needle) === 0;
    }
public static function startsWith(string $haystack, string $needle, bool $caseSensitive = true)
    {
        if ($caseSensitive) {
            return $needle === '' || strpos($haystack, $needle) === 0;
        }

        return $needle === '' || stripos($haystack, $needle) === 0;
    }
public static function startsWith ( string $ haystack , string $ needle , bool $ caseSensitive = true ) { if ( $ caseSensitive ) { return $ needle === '' || strpos ( $ haystack , $ needle ) === 0 ; } return $ needle === '' || stripos ( $ haystack , $ needle ) === 0 ; }
Return whether a string starts with a term

@param string $haystack      The string to search in
@param string $needle        The search term
@param bool   $caseSensitive Optional. Default: true

@return bool
Return whether a string starts with a term