Using PHP's parse_url Function

This is a PHP function that I wish I had known about earlier, so I thought it was worth a mention for today’s Daily Web Tip.

parse_url is a function that breaks a url down into it’s parts.

<?php print_r(parse_url('')) ?>

Will give you:

Array ( [scheme] => http [host] => [path] => /example/test.php [query] => id=255 [fragment] => faq1 )

Pretty cool!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top