Hi could anyone help me with this I have a URL like
parent/child/a=1&b=2$c=3
then I have a link that would add variable to that URL
modify_url_query($url, array('limit' => 50));
My function for modifying query in url
function modify_url_query($url, $mod){
$purl = parse_url($url);
$params = array();
if (($query_str=$purl['query']))
{
parse_str($query_str, $params);
foreach($params as $name => $value)
{
if (isset($mod[$name]))
{
$params[$name] = $mod[$name];
unset($mod[$name]);
}
}
}
$params = array_merge($params, $mod);
$ret = "";
if ($purl['scheme'])
{
$ret = $purl['scheme'] . "://";
}
if ($purl['host'])
{
$ret .= $purl['host'];
}
if ($purl['path'])
{
$ret .= $purl['path'];
}
if ($params)
{
$ret .= '?' . http_build_query($params);
}
if ($purl['fragment'])
{
$ret .= "#" . $purl['fragment'];
}
return $ret;
}