Use & instead of &. But this is only for printing to HTML, not for other URL usage such as sending in text emails or Location header redirects. $delim = htmlentities(urlencode(ini_get('arg_separator.output')));