1--TEST--
2Test http_build_query() function: usage variations - first arguments as multidimensional array and second argument present/not present
3--CREDITS--
4Adam Gegotek <adam [dot] gegotek [at] gmail [dot] com>
5--FILE--
6<?php
7/* Prototype  : string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
8 * Description: Generates a URL-encoded query string from the associative (or indexed) array provided.
9 * Source code: ext/standard/http.c
10*/
11
12$mDimensional = array(
13  20,
14  5 => 13,
15  "9" => array(
16    1 => "val1",
17    3 => "val2",
18    "string" => "string"
19  ),
20  "name" => "homepage",
21  "page" => 10,
22  "sort" => array(
23    "desc",
24    "admin" => array(
25      "admin1",
26      "admin2" => array(
27        "who" => "admin2",
28        2 => "test"
29      )
30    )
31  )
32);
33
34echo http_build_query($mDimensional) . PHP_EOL;
35echo http_build_query($mDimensional, 'prefix_');
36?>
37--EXPECT--
380=20&5=13&9%5B1%5D=val1&9%5B3%5D=val2&9%5Bstring%5D=string&name=homepage&page=10&sort%5B0%5D=desc&sort%5Badmin%5D%5B0%5D=admin1&sort%5Badmin%5D%5Badmin2%5D%5Bwho%5D=admin2&sort%5Badmin%5D%5Badmin2%5D%5B2%5D=test
39prefix_0=20&prefix_5=13&prefix_9%5B1%5D=val1&prefix_9%5B3%5D=val2&prefix_9%5Bstring%5D=string&name=homepage&page=10&sort%5B0%5D=desc&sort%5Badmin%5D%5B0%5D=admin1&sort%5Badmin%5D%5Badmin2%5D%5Bwho%5D=admin2&sort%5Badmin%5D%5Badmin2%5D%5B2%5D=test
40