This code:
$query = array(
"var" => "no",
"not_var" => "yes",
"var2" => "maybe"
);
print http_build_query($query);
Outputs:
var=no¬_var=yes&var2=maybe
This happens on my own machine running PHP 5.3.19. I’ve reproduced this behavior on PHPfiddle. It works as expected on ideone.com running PHP 5.2.11.
Why does this happen?
This is only because of your browser encoding the
¬entity, try this:For normal usage, it will be absolutely fine.
The reason it’s different on
ideonevsPHPFiddleis becausePHPFiddlejust dumps the results into an iframe, andideoneis displaying it pre-entity encoded so that other displays aren’t broken.