Just take a look at this url, and you will know what I mean.
https://www.google.com/search?q=site%3Aphpjs.org&q=date
And when I go to that url, the search term in google’s search bar is site:phpjs.org date.
How does Google ‘morph’ the two parameters together, and how would one do it in PHP?
Instead of encoding the space, Google uses the same
qvariable to accomplish the same thing.Unfortunately, PHP doesn’t have the built-in ability to do this, because successive occurrences of the same query string parameter will overwrite the first one, unless the
[]suffix is used.You would need something like this:
Contents of
$params:Alternatively, you can change the loop body to this:
That will change
$paramsto:Which will make it easier to just do: