bulit-in function

parse_url

 

 

parse_url

mixed parse_url ( string $url)

<?php
$url = 'http://username:password@hostname:80/path?arg=value#anchor';

print_r(parse_url($url));

echo parse_url($url, PHP_URL_PATH);
?>

Array
(
    [scheme] => http
    [host] => hostname
    [port] => 80
    [user] => username
    [pass] => password
    [path] => /path
    [query] => arg=value
    [fragment] => anchor
)
/path

# query - after the question mark ?
# fragment - after the hashmark #


 

 

 

Creative Commons license icon Creative Commons license icon