http_build_query
(written by Lawrence Krubner, however indented passages are often quotes)
PHP is an odd language, with odd habits. I was just looking for the file upload syntax in Symfony 1.4 and stumbled upon this bit of code.
if ($this->form->isValid())
{
foreach ($request->getFiles($this->form->getName()) as $uploadedFile)
{
$uploadDir = sfConfig::get(‘sf_upload_dir’) . ‘/assets’;
move_uploaded_file($uploadedFile["tmp_name"], $uploadDir . “/” . $uploadedFile["name"] );
}
$this->redirect(‘media/thumbnailSelector?’.http_build_query($this->form->getValues()));
}
I’d never seen http_build_query before, so I looked it up.
http_build_query — Generate URL-encoded query string
string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
Generates a URL-encoded query string from the associative (or indexed) array provided.
PHP has a lot of convenient functions like this, which are sort of just randomly thrown into the overall pile of functions that a programmer can use. This isn’t exactly a bad thing, but it does give PHP that unique feeling of being a random pile of convenience that no one put much thought into.
Source
May 17, 2012 2:06 am
From free cell phone ringtones on MySql Workbench is a total waste of time
"I like it so much, http://dailybooth.com/freecellphoneringto free cell phone ringtones, jsneke,..."