note 109386 added to function.parse-url
| From: | ashley at ashleywilson dot com dot au | Date: | Fri, 13 Jul 2012 05:08:02 +0000 |
| Subject: | note 109386 added to function.parse-url | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189114@lists.php.net to get a copy of this message | ||
You could write a wrapper for parse_url to convert the query string into an array, using parse_str()
as follows:
<?php
/**
* Split a given URL into its components.
* Uses parse_url() followed by parse_str() on the query string.
*
* @param string $url The string to decode.
* @return array Associative array containing the different components.
*/
function parse_url_detail($url){
$parts = parse_url($url);
if(isset($parts['query'])) {
parse_str(urldecode($parts['query']), $parts['query']);
}
return $parts;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 139.86.2.15 (proxied: 139.86.4.32)
----
Manual Page -- http://www.php.net/manual/en/function.parse-url.php
Edit -- https://master.php.net/note/edit/109386
Del: integrated -- https://master.php.net/note/delete/109386/integrated
Del: useless -- https://master.php.net/note/delete/109386/useless
Del: bad code -- https://master.php.net/note/delete/109386/bad+code
Del: spam -- https://master.php.net/note/delete/109386/spam
Del: non-english -- https://master.php.net/note/delete/109386/non-english
Del: in docs -- https://master.php.net/note/delete/109386/in+docs
Del: other reasons-- https://master.php.net/note/delete/109386
Reject -- https://master.php.net/note/reject/109386
Search -- https://master.php.net/manage/user-notes.php