Not a native PHP function, or at least not the last time I looked.
Creating a function to do it would be easy though, although it would depend on what you mean by "currently existing variables".
If you mean GET or POST vars (that you've modified perhaps), you could just loop through the array (HTTP_GET_VARS for example) and create the query that way:
<?PHP
function create_qs($a) {
while(list($k,$v) = each($a)) {
$kv[] .= "$k=" . urlencode($v);
}
$qs = "?" . implode("&",$kv);
return $qs;
}
?>
And call it like:
<?PHP
$qs = create_qs($HTTP_POST_VARS);
header("Location: /script.php" . $qs);
?>
If you mean everything in the currently running script, you could use the $GLOBALS array, but that's a fairly hefty array, and the server mightn't accept it via GET...
a
d
a
m