parse_url and pathinfo
parse_url:
=======
parse_url
- It parse a URL and return its components
Syntax:
=====
array parse_url ( string url)
This function returns an associative array returning any of the various components of the URL that are present. This includes the
scheme - e.g. http://
host
port
user
pass
path
query - after the question mark ?
fragment - after the hashmark #
Example:
======
parse_url(”http://www.sample.com/index.php?input=name”);
Output is:
Array
(
[scheme] => http
[host] => www.sample.com
[path] => /index.php
[query] => input=name
)
====================================================================
pathinfo:
======
pathinfo
- It returns information about a file path
Syntax:
=====
array pathinfo ( string path)
pathinfo() returns an associative array containing information about path.
The following array elements are returned: dirname, basename and extension.
Example:
======
pathinfo(”http://www.sample.com/index.php?input=name”);
Output is:
Array
(
[dirname] => http://www.sample.com
[basename] => index.php?input=name
[extension] => php?input=name
)
====================================================================
