php8.5
Home/ Manual/ whatwg / url/ Uri\WhatWg\Url::getScheme

Uri\WhatWg\Url::getScheme

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Retrieve the scheme component

Description

Uri\WhatWg\Url::getScheme(): string

Retrieves the scheme component.

Parameters Parameters

Return Values

Returns the scheme component as a String if the scheme component exists, null is returned otherwise.

Examples

Uri\WhatWg\Url::getScheme basic example

php
<?php
$url = new \Uri\WhatWg\Url("https://example.com");

echo $url->getScheme();
?>

The above example will output:

output
https

See Also

  • Uri\WhatWg\Url::withScheme
  • Uri\Rfc3986\Uri::getRawScheme
  • Uri\Rfc3986\Uri::getScheme

Source: reference/uri/uri/whatwg/url/getscheme.xml · from the official PHP manual (php/doc-en)