I know this is already 'solved', but I thought I'd mention the way I use it. I set this line of PHP code at the beginning of the PHP file I'm using:
PHP Code:
ini_set('arg_separator.output','&');
and that makes all the output argument separators the valid markup for & instead of the & symbol itself.
I only mention it because it means you wouldn't have to rewrite the existing function that PHP already has working for you.
But good job on that Mike.