$data = [
'foo' => 'bar',
'baz' => 'boom',
'cow' => 'milk',
'php' => 'hypertext processor'
];
echo http_build_query($data); // output: foo=bar&baz=boom&cow=milk&php=hypertext+processor
echo http_build_query($data, '', '&'); // output: foo=bar&baz=boom&cow=milk&php=hypertext+processor