File::isUrl( string $string ): bool

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Checks if a string is a valid URL.

Parameters

$stringstringrequired
The string to check.

Return

bool True if the string is a URL.

Source

private function isUrl(string $string): bool
{
    return filter_var($string, \FILTER_VALIDATE_URL) !== \false && preg_match('/^https?:\/\//i', $string);
}

Changelog

VersionDescription
0.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.