Hi,
I'm looking for the name of the PHP function to build a query string from an array of key value pairs. Please note, I am looking for the built in PHP function to do this, not a homebrew one (thats all a google search seems to return). There is one I just can't remeber it's name or find it on php.net. IIRC it's name isn't that intuitive.
Robin
From stackoverflow
-
I'm not aware of a builtin function, but there is the PECL class http://uk.php.net/manual/en/class.httpquerystring.php
-
Implode will combine an array into a string for you, but to make an SQL query out a kay/value pair you'll have to write your own function.
: Tried that but it won't work. I'm trying to build an http query string which requires both the keys and the values from the array, implode can't do this.Click Upvote : I see, wasn't sure if you meant an SQL query string or a http query string. -
Your looking for http_build_query().
: Yeah, that's the one.ceejayoz : Wish I'd known about that function a long time ago. Heh.Rimian : I can never remember it either.
0 comments:
Post a Comment