PHP » GoLang |
login |
register |
about
|
http_build_query(PHP 5, PHP 7) http_build_query — Generate URL-encoded query string Description
string http_build_query
( mixed
$query_data
[, string $numeric_prefix
[, string $arg_separator
[, int $enc_type = PHP_QUERY_RFC1738
]]] )Generates a URL-encoded query string from the associative (or indexed) array provided. Parameters
Return ValuesReturns a URL-encoded string. Changelog
ExamplesExample #1 Simple usage of http_build_query()
<?php The above example will output: foo=bar&baz=boom&cow=milk&php=hypertext+processor foo=bar&baz=boom&cow=milk&php=hypertext+processor Example #2 http_build_query() with numerically index elements.
<?php The above example will output: 0=foo&1=bar&2=baz&3=boom&cow=milk&php=hypertext+processor myvar_0=foo&myvar_1=bar&myvar_2=baz&myvar_3=boom&cow=milk&php=hypertext+processor Example #3 http_build_query() with complex arrays
<?php this will output : (word wrapped for readability) user%5Bname%5D=Bob+Smith&user%5Bage%5D=47&user%5Bsex%5D=M& user%5Bdob%5D=5%2F12%2F1956&pastimes%5B0%5D=golf&pastimes%5B1%5D=opera& pastimes%5B2%5D=poker&pastimes%5B3%5D=rap&children%5Bbobby%5D%5Bage%5D=12& children%5Bbobby%5D%5Bsex%5D=M&children%5Bsally%5D%5Bage%5D=8& children%5Bsally%5D%5Bsex%5D=F&flags_0=CEO
Example #4 Using http_build_query() with an object
<?php The above example will output: pub=publicParent&pub_bar%5Bpub%5D=publicChild See Also
|
more
Recently updated
more
Most requested
more
Last requests
|