Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

parse url function syntax tag tutorial 2013 Donate at flattr Flattr this

Alert! Connect with 10,000 Chating Online. Join Now

Php parse url () function

Write your php code

<?php ?>

Php Result

Your code below

(PHP 3, PHP 4 , PHP 5)

parse_url -- Parse a URL and return its components


array parse_url ( string url )

This function returns an associative array containing any of the various components of the URL that are present. If one of them is missing, no entry will be created for it. The components are :

  • scheme - e.g. http

  • host

  • port

  • user

  • pass

  • path

  • query - after the question mark ?

  • fragment - after the hashmark #

This function is not meant to validate the given URL, it only breaks it up into the above listed parts. Partial URLs are also accepted, parse_url() tries its best to parse them correctly.

Note: This function doesn't work with relative URLs.

Example 1. parse_url() example

$ php -r 'print_r(parse_url("http://username:password@hostname/path?arg=value#anchor"));'
    [scheme] => http
    [host] => hostname
    [user] => username
    [pass] => password
    [path] => /path
    [query] => arg=value
    [fragment] => anchor

$ php -r 'print_r(parse_url(""));'
    [scheme] => http
    [host] =>
    [path] => /

See also pathinfo(), parse_str(), dirname(), and basename().

Php parse url Function syntax tag

parse url php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online

Php parse url syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.

Function index







Date & Time

Directory function




Form data handling

Mathematics operators


Php Mysql

Network Functions


php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online