PHP | http_build_query() Function Last Updated : 09 Jul, 2019 Comments Improve Suggest changes Like Article Like Report The http_build_query() function is an inbuilt function in PHP which is used to generate URL-encoded query string from the associative (or indexed) array. Syntax: string http_build_query( $query_data, $numeric_prefix, $arg_separator, $enc_type = PHP_QUERY_RFC1738 ) Parameters: This function accepts four parameters as mentioned above and described below: $query_data: This parameter holds the array or object containing properties which are given below: It may be a single dimensional array or multi-dimensional array. If $query_data is an object then only public property will be incorporated into the result . $numeric_prefix: This parameter is used if numeric indices are used in the base array, it will be prepended to the numeric index for elements in the base array only. $arg_separator: It is used to separate arguments but may be overridden by specifying this parameter. $enc_type: Its default value is PHP_QUERY_RFC1738. Return Values: It returns a URL-encoded string. Below programs illustrate the http_build_query() function in PHP: Program 1: php <?php $info = array( 'sudo' => 'placement', 'CPP' => 'course', 'FORK' => 'C', ); echo http_build_query($info) . "#"; echo http_build_query($info, '', '&'); ?> Output: sudo=placement&CPP=course&FORK=C#sudo=placement&CPP=course&FORK=C Program 2: php <?php $info = array('geeks', 'gfg' => 'sudo', 'placement' => 'hypertext processor'); echo http_build_query($info) . "$"; echo http_build_query($info, 'myvar_'); ?> Output: 0=geeks&gfg=sudo&placement=hypertext+processor$myvar_0=geeks&gfg=sudo&placement=hypertext+processor Reference: http://docs.php.net/manual/da/function.http-build-query.php Comment More infoAdvertise with us Next Article PHP | http_build_query() Function C Code_Mech Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | filter_has_var() function The filter_has_var() function is an inbuilt function in PHP which is used to check whether the variable available or not especially it checks if a variable of a specified input type exist or not. It returns True on success or False on failure. Syntax: bool filter_has_var( $type, $variable_name ) Par 2 min read PHP | parse_url() Function The parse_url() function is an inbuilt function in PHP which is used to return the components of a URL by parsing it. It parses an URL and return an associative array which contains its various components. Syntax: parse_url( $url, $component = -1 ) Parameters: This function accepts two parameters as 2 min read PHP | get_defined_vars() Function The get_defined_vars() function is an inbuilt function in PHP which is used to returns an array of all defined variables. This function returns a multidimensional array which contains all the list of variables, environment etc. Syntax: array get_defined_vars( void ) Parameters: This function does no 1 min read PHP token_get_all() Function The token_get_all() function is an inbuilt function in PHP that is used to tokenize a given PHP source code string into an array of tokens. This function is particularly useful for analyzing, parsing, or manipulating PHP code programmatically. Syntax: token_get_all(string $code, int $flags = 0)Param 2 min read PHP class_uses() Function The class_uses() function is an inbuilt function in PHP where the traits utilized by the given class, will be returned. Syntax: class_uses($object_or_class,$autoload = true): array|false Parameters: This function accepts the two parameters that are described below object_or_class: The name of the cl 2 min read PHP | hash_final() Function The hash_final() function is an inbuilt function in PHP which is used to finalize an incremental hash and return the resulting digest. Syntax: hash_final( $context, $raw_output ) Parameters: This function accept two parameters as mention above and describe below. $context: This parameter is used to 1 min read PHP | geoip_db_avail() Function The geoip_db_avail() function is an inbuilt function in PHP which is used to check whether a GeoIP database is available or not. The function does not consider the proper existence of a file instead it checks whether it is readable or not. Syntax: bool geoip_db_avail( $database ) Parameters: This fu 2 min read PHP | filter_list() Function The filter_list() function is an inbuilt function in PHP which is used to returns the list of all supported filters. Syntax: array filter_list( void ) Parameters: This function does not accepts any parameters. Return Values: It returns an array containing all names of supported filters. If it return 2 min read PHP | call_user_func() Function The call_user_func() is an inbuilt function in PHP which is used to call the callback given by the first parameter and passes the remaining parameters as argument. It is used to call the user-defined functions. Syntax: mixed call_user_func ( $function_name[, mixed $value1[, mixed $... ]]) Here, mixe 2 min read PHP var_dump() Function The var_dump() function in PHP is used to display structured information about one or more variables. The structured information means type and value of the given variable. It outputs not just the value of the variable but also its data type and, in the case of arrays or objects, all of their struct 2 min read Like