I'm looking for a simple function which will remove blank or duplicate variables from a query string in PHP. Take this query string for example:
?input=timeline&list=&search=&type=&count=10&keyword=hello&from=&language=en&keyword=&language=en&input=timeline
As you can see there are two input=timeline and the language and keyword variables appear twice- once set and once not. Also there are lots of variables that are blank- list, search and type.
What function would clean the URL up to make:
?input=timeline&count=10&keyword=hello&from=&language=en
?
I've found functions that remove queries, or certain variables, but nothing that comes close to the above- I can't get my head round this. Thanks!