http_build_query Generate URL-encoded query string &reftitle.description; stringhttp_build_query arrayobjectdata stringnumeric_prefix"" stringnullarg_separator&null; intencoding_typePHP_QUERY_RFC1738 Generates a URL-encoded query string from the associative (or indexed) array provided. &reftitle.parameters; data May be an array or object containing properties. If data is an array, it may be a simple one-dimensional structure, or an array of arrays (which in turn may contain other arrays). If data is an object, then only public properties will be incorporated into the result. numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. This is meant to allow for legal variable names when the data is decoded by PHP or another CGI application later on. arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. encoding_type By default, PHP_QUERY_RFC1738. If encoding_type is PHP_QUERY_RFC1738, then encoding is performed per RFC 1738 and the application/x-www-form-urlencoded media type, which implies that spaces are encoded as plus (+) signs. If encoding_type is PHP_QUERY_RFC3986, then encoding is performed according to RFC 3986, and spaces will be percent encoded (%20). &reftitle.returnvalues; Returns a URL-encoded string. &reftitle.examples; Simple usage of <function>http_build_query</function> 'bar', 'baz' => 'boom', 'cow' => 'milk', 'null' => null, 'php' => 'hypertext processor' ); echo http_build_query($data) . "\n"; echo http_build_query($data, '', '&'); ?> ]]> &example.outputs; <function>http_build_query</function> with numerically index elements. 'milk', 'php' => 'hypertext processor'); echo http_build_query($data) . "\n"; echo http_build_query($data, 'myvar_'); ?> ]]> &example.outputs; <function>http_build_query</function> with complex arrays array( 'name' => 'Bob Smith', 'age' => 47, 'sex' => 'M', 'dob' => '5/12/1956' ), 'pastimes' => array('golf', 'opera', 'poker', 'rap'), 'children' => array( 'bobby' => array('age'=>12, 'sex'=>'M'), 'sally' => array('age'=>8, 'sex'=>'F') ), 'CEO' ); echo http_build_query($data, 'flags_'); ?> ]]> this will output : (word wrapped for readability) Only the numerically indexed element in the base array "CEO" received a prefix. The other numeric indices, found under pastimes, do not require a string prefix to be legal variable names. Using <function>http_build_query</function> with an object pub_bar = new childClass(); $this->prot_bar = new childClass(); $this->priv_bar = new childClass(); } } class childClass { public $pub = 'publicChild'; protected $prot = 'protectedChild'; private $priv = 'privateChild'; } $parent = new parentClass(); echo http_build_query($parent); ?> ]]> &example.outputs; &reftitle.seealso; parse_str parse_url urlencode array_walk