Posted By

iloveitaly on 06/04/09


Tagged

edit php String query set create update qstring


Versions (?)

Create Query String


 / Published in: PHP
 

More of a setQueryString

  1. function getQueryString(Array $newQuery, $keepOld) {
  2. static $currentQueryArray;
  3.  
  4. // check to see if the current
  5. if(!is_array($currentQueryArray)) {
  6. $currentQueryArray = array();
  7. parse_str($_SERVER['QUERY_STRING'], $currentQueryArray);
  8. }
  9.  
  10. if($keepOld) $newQueryArray = array_merge($currentQueryArray, $newQuery);
  11. else $newQueryArray = $newQuery;
  12.  
  13. return http_build_query($newQueryArray);
  14. }

Report this snippet  

You need to login to post a comment.