If we have PHP associative array of data and its necessary to build link like key1=value1&key2=value2&key3=value3 we can use next WordPress function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /** * Build URL query based on an associative and, or indexed array. * * This is a convenient function for easily building url queries. It sets the * separator to '&' and uses _http_build_query() function. * * * @see _http_build_query() Used to build the query * @see http://us2.php.net/manual/en/function.http-build-query.php for more on what * http_build_query() does. * * @param array $data URL-encode key/value pairs. * @return string URL-encoded string. */ function build_query($data) { return _http_build_query($data, null, '&', '', false); } |
