I\'m working with a third party API that receives several parameters which must be encoded like this:
text[]=Hello%20World&text[]=How%20are%20you?&ht
I don't know a standard way to do it (I think there is no such way), but here's an ugly solution:
Since [] is encoded by http_build_query, you may generate string with indices and then replace them.
[]
http_build_query
preg_replace('/(%5B)\d+(%5D=)/i', '$1$2', http_build_query($params));