note 86060 modified in function.parse-url by danbrown
| From: | danbrown@php.net | Date: | Wed, 01 Oct 2008 16:31:24 +0000 |
| Subject: | note 86060 modified in function.parse-url by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-144942@lists.php.net to get a copy of this message | ||
I need to parse out the query string from the referrer, so I created this function.
<?php
function parse_query($val)
{
/**
* Use this function to parse out the query array element from
* the output of parse_url().
*/
$var = html_entity_decode($var);
$var = explode('&', $var);
$arr = array();
foreach($var as $val)
{
$x = explode('=', $val);
$arr[$x[0]] = $x[1];
}
unset($val, $x, $var);
return $arr;
}
?>
--was--
I need to parse out the query string from the referrer, so I created this function.
function parse_query($val)
{
/**
* Use this function to parse out the query array element from
* the output of parse_url().
*/
$var = html_entity_decode($var);
$var = explode('&', $var);
$arr = array();
foreach($var as $val)
{
$x = explode('=', $val);
$arr[$x[0]] = $x[1];
}
unset($val, $x, $var);
return $arr;
}
http://php.net/manual/en/function.parse-url.php