I just discover these functions seems redundant.
http_build_query() belong to  standard php functions.
http_build_str() is part of pecl_http package.
are they 100% redundant ?
I am focused on getting the perfect reverse function of parse_str(). since http_build query() is broken. ( see reference )
I  wondering if there is some way that http_build_str() could have any advantage to support/tolerate more edge cases.
By reading the API, it appears that http_build_str() does not URL encode the parameters, while http_build_query() does.
http_build_str() also can take either an object OR an object as its primary argument, while http_build_query() only takes an array.
Redundant to an extent. But, if you refer to the PHP documentation, you ought to see distinct differences:
http://php.net/manual/en/function.http-build-query.php
http://php.net/manual/en/function.http-build-str.php
In the very least, you ought to see that http_build_query() is core PHP and supports an additional encoding style parameter. And you ought to see that http_build_str() is a PECL extension.
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