http_build_query($array)
will convert array to the format of a=1&b=2
,
But how to make it convert to the format of a=1;b=2
?
Is there a native function there?
The http_build_query() function is an inbuilt function in PHP which is used to generate URL-encoded query string from the associative (or indexed) array.
A query string is a term for adding/passing data in the URL. It is not language specific.
Definition and Usage The parse_str() function parses a query string into variables. Note: If the array parameter is not set, variables set by this function will overwrite existing variables of the same name.
The third parameter to http_build_query is the separator; call it with http_build_query($array, "", ";")
to get what you're after.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With