PHP 8.5.0 Alpha 2 available for testing

Voting

: one plus five?
(Example: nine)

The Note You're Voting On

Michael
6 years ago
There's a quirk where this function will return the host as the "path" if there is a leading space.

<?php

$url
= ' https://foobar.com:80/mypath/myfile.php';

print_r(parse_url($url));
/*
Array
(
[path] => https://foobar.com:80/mypath/myfile.php
)
*/

print_r(trim(parse_url($url)));
/*
Array
(
[scheme] => https
[host] => foobar.com
[port] => 80
[path] => /mypath/myfile.php
)
*/

?>

<< Back to user notes page

To Top