PHP URL parsing for multiple variables

OK, this one I did write myself.  It is used for building the URL link when filtering multiple columns..

Use is as the URL inside the ‘href’, passing the url var that you want to change, or remove.  (This would also be useful for pagination links..)

function buildQryReplace($field,$value){
    $gets = parse_url($_SERVER['REQUEST_URI']); // get URL
    parse_str($gets['query'],$getVarsArray);    // create GET vars as an array
    $getVarsArray[$field] = $value;             // overwrite the var that we want to change / add
    return '?'.http_build_query($getVarsArray); // build the array back with the new value
// ?name=Chris&age=50
// buildQryReplace('name','Joe');
// ?name=fff&age=50