3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url1 = Uri\WhatWg\Url::parse("https://example.com"); $url2 = $url1->withPort(-1); var_dump($url2);
Output for 8.5.0 - 8.5.3
Fatal error: Uncaught Uri\WhatWg\InvalidUrlException: The specified port is malformed in /in/iiVjQ:4 Stack trace: #0 /in/iiVjQ(4): Uri\WhatWg\Url->withPort(-1) #1 {main} thrown in /in/iiVjQ on line 4
Process exited with code 255.
Output for 8.1.34, 8.2.30, 8.3.5 - 8.3.30, 8.4.9 - 8.4.18
Fatal error: Uncaught Error: Class "Uri\WhatWg\Url" not found in /in/iiVjQ:3 Stack trace: #0 {main} thrown in /in/iiVjQ on line 3
Process exited with code 255.

preferences:
44.7 ms | 587 KiB | 4 Q