SQLTerminal.app
now available
Want fresh tech tips in your inbox?

How to Parse Query Strings in PHP

       

Here is a quick snippet for parsing query strings in PHP. You can use the parse_url and parse_str methods. parse_str will create a variable for you populated with results.

$url = "http://www.seanbehan.com/path/?param=key";
parse_str(parse_url(trim($url))['query'], $qs); 
echo $qs;
// returns ['param' => 'key']
Tagged w/ #query string #php #urls #snippets

Apps I've Built

XPath Expression Editor
Practice and improve your XPath skills with XPath Editor
Click to buy on the App Store
Photo Location Changer
Easily change the location on your photos and videos
Click here for more info about the app
Photo Date Changer
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app