_http_build_query

From php.net (modified by Mark Jaquith to behave like the native PHP5 function).

Description

http_build_query( $params, (constant) $key = null ); 

Parameters (2)

0. $params
The params.
1. $key — Optional. (constant) => null
The key.

Usage

  1. if ( !function_exists( 'http_build_query' ) ) { 
  2. require_once '/google-analyticator.php'; 
  3.  
  4. // The params. 
  5. $params = null; 
  6.  
  7. // The key. 
  8. $key = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = http_build_query($params, $key); 
  12.  

Defined (1)

The function is defined in the following location(s).

/google-analyticator.php  
  1. function http_build_query($params, $key = null) 
  2. $ret = array(); 
  3.  
  4. foreach( (array) $params as $name => $val ) { 
  5. $name = urlencode($name); 
  6.  
  7. if ( $key !== null ) 
  8. $name = $key . "[" . $name . "]"; 
  9.  
  10. if ( is_array($val) || is_object($val) ) 
  11. $ret[] = http_build_query($val, $name); 
  12. elseif ($val !== null) 
  13. $ret[] = $name . "=" . urlencode($val); 
  14.  
  15. return implode("&", $ret);