php8.5
Home/ Manual/ rfc3986 / uri/ Uri\Rfc3986\Uri::getScheme

Uri\Rfc3986\Uri::getScheme

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Retrieve the normalized scheme component

Description

Uri\Rfc3986\Uri::getScheme(): string|null

Retrieves the normalized scheme component.

Parameters Parameters

Return Values

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

Examples

Uri\Rfc3986\Uri::getScheme basic example

php
<?php
$uri = new \Uri\Rfc3986\Uri("https://example.com");

echo $uri->getScheme();
?>

The above example will output:

output
https

See Also

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

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