News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer's Blog:
Easy way to build GET query strings in php
November 13, 2008 @ 12:47:01

Sameer has come up with an easy way to build out query strings to use in your GET requests:

Passing variables with a url is such a frequent thing programmers do that most of you may think this post is unwarranted. We call this method of passing variables as GET, the other being POST. It is one of those things which can be easily done in php. [...] The best way to pass GET variables is to use the http_build_query() function available from php version 5; which takes an array of variables and builds a nice URL encoded string which you can append to a url. And example is shown below.

He includes two code examples - one showing "the old way" of building it out by hand and the other using the http_build_query function. You pass in an array and what to connect them with and it builds out the string, no matter how many arguments there are.

0 comments voice your opinion now!
php5 httpbuildquery query string build tutorial


blog comments powered by Disqus

Similar Posts

Christopher Bledsoe's Blog: PHP Dependency Injection (Inversion of Control)

WebReference.com: Building a Weblog: Part 4

PHPBuilder.com: Beginning Ajax with PHP: From Novice to Professional

Internet Super Hero Blog: MySQL native driver for PHP: mysqlnd-5.0.1-beta available

PHPBuilder.com: Profiling PHP Code with Xdebug and KCacheGrind


Community Events





Don't see your event here?
Let us know!


conference series introduction laravel configure version language framework community api opinion composer podcast threedevsandamaybe interview list release unittest voicesoftheelephpant symfony

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework