static function appendToUrl($url, $append)
	{
		if ( $append )
		{
		    $regs = [];
			if ( preg_match('|^(.+?)(?:\?(.*?))?(#.*)?$|', $url, $regs) )
			{
				$u = $regs[1];  // URL part
				$q = $regs[2];  // querystring
				$a = $regs[3];  // anchor #xxxx
				
				// append a new parameter if one or more already exist
				if ( $q )
					$q = $q . "&" . $append;
				else
					$q = $append;
					
				// rebuild full url
				return $u . '?' . $q . $a;
			}
			else
				// impossible case 
				return $url;
		}
		else
			return $url;
	}
static function appendToUrl($url, $append)
	{
		if ( $append )
		{
		    $regs = [];
			if ( preg_match('|^(.+?)(?:\?(.*?))?(#.*)?$|', $url, $regs) )
			{
				$u = $regs[1];  // URL part
				$q = $regs[2];  // querystring
				$a = $regs[3];  // anchor #xxxx
				
				// append a new parameter if one or more already exist
				if ( $q )
					$q = $q . "&" . $append;
				else
					$q = $append;
					
				// rebuild full url
				return $u . '?' . $q . $a;
			}
			else
				// impossible case 
				return $url;
		}
		else
			return $url;
	}
static function appendToUrl ( $ url , $ append ) { if ( $ append ) { $ regs = [ ] ; if ( preg_match ( '|^(.+?)(?:\?(.*?))?(#.*)?$|' , $ url , $ regs ) ) { $ u = $ regs [ 1 ] ; // URL part $ q = $ regs [ 2 ] ; // querystring $ a = $ regs [ 3 ] ; // anchor #xxxx // append a new parameter if one or more already exist if ( $ q ) $ q = $ q . "&" . $ append ; else $ q = $ append ; // rebuild full url return $ u . '?' . $ q . $ a ; } else // impossible case  return $ url ; } else return $ url ; }
Append a parameter to an url

@param string $url Url string to process
@param string $append Querystring to append to $url
@return string Return a new url with appended string
Append a parameter to an url