note 91469 deleted from httpquerystring.set by sobak
| From: | sobak@php.net | Date: | Sun, 04 Dec 2016 07:26:46 +0000 |
| Subject: | note 91469 deleted from httpquerystring.set by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208107@lists.php.net to get a copy of this message | ||
Note Submitter: michal dot kocarek at brainbox dot cz
----
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"
?>