Aedating v4 0 0002 php null pass
As noted, this function omits keys with null values.
This could break some code which treats the key as boolean, and so has no value, or other code expecting the array to be populated regardless of value.
*/Caution It is strongly recommended that you do not generate your own salt for this function.
It will create a secure salt automatically for you if you do not specify one.
Don't try to outsmart these defaults by creating something less secure.
A workaround for this is to replace the null values with an empty string: $data=array( 'a'='…', ); // Compensate for fact that http_build_query omits null values foreach($data as &$datum) if($datum===null) $datum=''; Losing the null-ness of the original is no real loss if it’s supposed to be a real query string.
If the null is important, you could use a dummy value instead.
If you're then sending this off for POST again, you won't get the expected result. Instead you can make your own simple function if you simply want to pass along the data: Be careful about Example 1 -- it is exactly how *not* to implement things.& as a separator is the URL encoding.& is HTML encoding.
You should HTML encode your URL if embedding it in a web page.