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

Uri\WhatWg\Url::getPassword

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Retrieve the password component

Description

Uri\WhatWg\Url::getPassword(): string|null

Retrieves the password component.

Parameters Parameters

Return Values

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

Examples

Uri\WhatWg\Url::getPassword basic example

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

echo $url->getPassword();
?>

The above example will output:

output
password

See Also

  • Uri\WhatWg\Url::withPassword
  • Uri\Rfc3986\Uri::getRawPassword
  • Uri\Rfc3986\Uri::getPassword

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