note 91469 modified in function.httpquerystring-set by danbrown
| From: | danbrown@php.net | Date: | Thu, 11 Jun 2009 13:58:06 +0000 |
| Subject: | note 91469 modified in function.httpquerystring-set by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156773@lists.php.net to get a copy of this message | ||
Function accepts string or associative array in the params argument.
<?php
$query = new HttpQueryString(false); // query is empty
$query->set(array('city' => 'Prague', 'age' => 34)); //
query is "city=Prague&age=34"
$query->set('age=20&gender=male'); // query is
"city=Prague&age=20&gender=male"
?>
Also please note that variable can be unset *only* by passing NULL value in an associative array.
<?php
$query->set('city='); // query is "city=&age=20&gender=male"
$query->set(array('city' => null)); // and now "age=20&gender=male"
?>
--was--
Function accepts string or associative array in the params argument.
<? $query = new HttpQueryString(false); // query is empty
$query->set(array('city' => 'Prague', 'age' => 34)); //
query is âcity=Prague&age=34â
$query->set('age=20&gender=male'); // query is
âcity=Prague&age=20&gender=maleâ ?>
Also please note that variable can be unset *only* by passing NULL value in an associative array.
<? $query->set('city='); // query is âcity=&age=20&gender=maleâ
$query->set(array('city' => null)); // and now âage=20&gender=maleâ
?>
http://php.net/manual/en/function.httpquerystring-set.php