PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
jasongr
Forum Contributor
Posts: 206 Joined: Tue Jul 27, 2004 6:19 am
Post
by jasongr » Sun Sep 12, 2004 3:47 am
Hello
I was wondering if anyone knows if there is a PHP function that takes as input a URL string, parses it and returns an array of all the parameters in the string.
Here is an example:
"text.html?a=1&b=2&c=3"
output would be:
array('a' => 1, 'b' => 2, 'c' => 3)
regards
mudkicker
Forum Contributor
Posts: 479 Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:
Post
by mudkicker » Sun Sep 12, 2004 4:11 am
$_SERVER['QUERY_STRING'] would be may be helpful...
jasongr
Forum Contributor
Posts: 206 Joined: Tue Jul 27, 2004 6:19 am
Post
by jasongr » Sun Sep 12, 2004 4:17 am
I have found parse_str() to be useful
kettle_drum
DevNet Resident
Posts: 1150 Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England
Post
by kettle_drum » Sun Sep 12, 2004 8:16 am
jasongr
Forum Contributor
Posts: 206 Joined: Tue Jul 27, 2004 6:19 am
Post
by jasongr » Sun Sep 12, 2004 8:34 am
Actually I was looking for a function that will parse the string into an array I can later manipulate, not just to see it
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Sep 12, 2004 10:21 am
you can play with the $_GET array all you want.. it's writable.