(PHP 8 >= 8.5.0)
Uri\WhatWg\Url::withScheme — Modifie le composant schéma
Crée une nouvelle URL et modifie son composant schéma.
schemeL'instance Uri\WhatWg\Url modifiée.
Si l'URL résultante est invalide, une exception Uri\WhatWg\InvalidUrlException est lancée.
Exemple #1 Exemple simple avec Uri\WhatWg\Url::withScheme()
<?php
$url = new \Uri\WhatWg\Url("https://example.com");
$url = $url->withScheme("http");
echo $url->getScheme();
?>L'exemple ci-dessus va afficher :
http