3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $nested = array( 'key' => 'val', 'key1' => array( 'subkey' => 'subval', 'subkey1' => 'subval1' ), 'key2' => array('a', 'b', 'c', 'd'), '2D_collection_5' => array( array( 'id' => 1, 'name' => 'lorem', 'categoryId' => 5, 'date' => '2013.07.08' ), array( 'id' => 2, 'name' => 'ipsum', 'categoryId' => 3, 'date' => '2013.07.07' ), array( 'id' => 5, 'name' => 'dolor', 'categoryId' => 1, 'date' => '2012.07.08' ), array( 'id' => 6, 'name' => 'sit', 'categoryId' => 3, 'date' => '2013.12.08' ), array( 'id' => 9, 'name' => 'amet', 'categoryId' => 5, 'date' => '2013.10.14' ) ), '2D_collection_5_named' => array( 'lorem' => array( 'id' => 1, 'name' => 'lorem', 'categoryId' => 5, 'date' => '2013.07.08' ), 'ipsum' => array( 'id' => 2, 'name' => 'ipsum', 'categoryId' => 3, 'date' => '2013.07.07' ), 'dolor' => array( 'id' => 5, 'name' => 'dolor', 'categoryId' => 1, 'date' => '2012.07.08' ), 'sit' => array( 'id' => 6, 'name' => 'sit', 'categoryId' => 3, 'date' => '2013.12.08' ), 'amet' => array( 'id' => 9, 'name' => 'amet', 'categoryId' => 5, 'date' => '2013.10.14' ) ) ); echo http_build_query($nested);
based on 69JdH
Output for 5.1.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
key=val&key1%5Bsubkey%5D=subval&key1%5Bsubkey1%5D=subval1&key2%5B0%5D=a&key2%5B1%5D=b&key2%5B2%5D=c&key2%5B3%5D=d&2D_collection_5%5B0%5D%5Bid%5D=1&2D_collection_5%5B0%5D%5Bname%5D=lorem&2D_collection_5%5B0%5D%5BcategoryId%5D=5&2D_collection_5%5B0%5D%5Bdate%5D=2013.07.08&2D_collection_5%5B1%5D%5Bid%5D=2&2D_collection_5%5B1%5D%5Bname%5D=ipsum&2D_collection_5%5B1%5D%5BcategoryId%5D=3&2D_collection_5%5B1%5D%5Bdate%5D=2013.07.07&2D_collection_5%5B2%5D%5Bid%5D=5&2D_collection_5%5B2%5D%5Bname%5D=dolor&2D_collection_5%5B2%5D%5BcategoryId%5D=1&2D_collection_5%5B2%5D%5Bdate%5D=2012.07.08&2D_collection_5%5B3%5D%5Bid%5D=6&2D_collection_5%5B3%5D%5Bname%5D=sit&2D_collection_5%5B3%5D%5BcategoryId%5D=3&2D_collection_5%5B3%5D%5Bdate%5D=2013.12.08&2D_collection_5%5B4%5D%5Bid%5D=9&2D_collection_5%5B4%5D%5Bname%5D=amet&2D_collection_5%5B4%5D%5BcategoryId%5D=5&2D_collection_5%5B4%5D%5Bdate%5D=2013.10.14&2D_collection_5_named%5Blorem%5D%5Bid%5D=1&2D_collection_5_named%5Blorem%5D%5Bname%5D=lorem&2D_collection_5_named%5Blorem%5D%5BcategoryId%5D=5&2D_collection_5_named%5Blorem%5D%5Bdate%5D=2013.07.08&2D_collection_5_named%5Bipsum%5D%5Bid%5D=2&2D_collection_5_named%5Bipsum%5D%5Bname%5D=ipsum&2D_collection_5_named%5Bipsum%5D%5BcategoryId%5D=3&2D_collection_5_named%5Bipsum%5D%5Bdate%5D=2013.07.07&2D_collection_5_named%5Bdolor%5D%5Bid%5D=5&2D_collection_5_named%5Bdolor%5D%5Bname%5D=dolor&2D_collection_5_named%5Bdolor%5D%5BcategoryId%5D=1&2D_collection_5_named%5Bdolor%5D%5Bdate%5D=2012.07.08&2D_collection_5_named%5Bsit%5D%5Bid%5D=6&2D_collection_5_named%5Bsit%5D%5Bname%5D=sit&2D_collection_5_named%5Bsit%5D%5BcategoryId%5D=3&2D_collection_5_named%5Bsit%5D%5Bdate%5D=2013.12.08&2D_collection_5_named%5Bamet%5D%5Bid%5D=9&2D_collection_5_named%5Bamet%5D%5Bname%5D=amet&2D_collection_5_named%5Bamet%5D%5BcategoryId%5D=5&2D_collection_5_named%5Bamet%5D%5Bdate%5D=2013.10.14
Output for 5.0.0 - 5.1.2
key=val&key1[subkey]=subval&key1[subkey1]=subval1&key2[0]=a&key2[1]=b&key2[2]=c&key2[3]=d&2D_collection_5[0][id]=1&2D_collection_5[0][name]=lorem&2D_collection_5[0][categoryId]=5&2D_collection_5[0][date]=2013.07.08&2D_collection_5[1][id]=2&2D_collection_5[1][name]=ipsum&2D_collection_5[1][categoryId]=3&2D_collection_5[1][date]=2013.07.07&2D_collection_5[2][id]=5&2D_collection_5[2][name]=dolor&2D_collection_5[2][categoryId]=1&2D_collection_5[2][date]=2012.07.08&2D_collection_5[3][id]=6&2D_collection_5[3][name]=sit&2D_collection_5[3][categoryId]=3&2D_collection_5[3][date]=2013.12.08&2D_collection_5[4][id]=9&2D_collection_5[4][name]=amet&2D_collection_5[4][categoryId]=5&2D_collection_5[4][date]=2013.10.14&2D_collection_5_named[lorem][id]=1&2D_collection_5_named[lorem][name]=lorem&2D_collection_5_named[lorem][categoryId]=5&2D_collection_5_named[lorem][date]=2013.07.08&2D_collection_5_named[ipsum][id]=2&2D_collection_5_named[ipsum][name]=ipsum&2D_collection_5_named[ipsum][categoryId]=3&2D_collection_5_named[ipsum][date]=2013.07.07&2D_collection_5_named[dolor][id]=5&2D_collection_5_named[dolor][name]=dolor&2D_collection_5_named[dolor][categoryId]=1&2D_collection_5_named[dolor][date]=2012.07.08&2D_collection_5_named[sit][id]=6&2D_collection_5_named[sit][name]=sit&2D_collection_5_named[sit][categoryId]=3&2D_collection_5_named[sit][date]=2013.12.08&2D_collection_5_named[amet][id]=9&2D_collection_5_named[amet][name]=amet&2D_collection_5_named[amet][categoryId]=5&2D_collection_5_named[amet][date]=2013.10.14
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: http_build_query() in /in/nDjDP on line 77
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: http_build_query() in /in/nDjDP on line 77
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: http_build_query() in /in/nDjDP on line 77