We know that the parse_str () function of PHP can parse the string in URL Query format into an associative array, the same policy that PHP generates $_get use. The inverse function of parse_str () is Http_build_query (), which generates the URL query string for associative arrays and objects. However, they are supported only after PHP5. So, we need to write our own http_build_query ()
function My_http_build_query ($data) {$str = '; foreach ($data as $key => $value) {foreach (Child_str ($value) as $v) {$s tr. = "$key $v&"; } return substr ($str, 0, strlen ($str)-1); function Child_str ($data) {$str = array (); if (Is_array ($data)) {foreach ($data as $key => $value) {foreach (Child_str $v Alue) as $v) {$str [] = "[$key] $v"; }}else{//Do urls encoding here $data = Str_replace (' & ', '%26 ', ' = '. $data); $str [] = $data; return $STR;}