note 91471 modified in function.httpquerystring-construct by danbrown
| From: | danbrown@php.net | Date: | Thu, 11 Jun 2009 14:22:10 +0000 |
| Subject: | note 91471 modified in function.httpquerystring-construct by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156776@lists.php.net to get a copy of this message | ||
Note about first argument when calling the constructor:
â if true, instance will have initially exactly same query string as PHP received when user
accessed the page
â if false, instance will be empty.
<?php
// Imagine that user puts "test.php?name=JamesBond&age=30" into browser, thenâ¦
$query = new HttpQueryString(); // query is "name=JamesBond&age=30". (First argument
is true by default.)
$query = new HttpQueryString(false); // query is empty
$query = new HttpQueryString(true, 'age=31'); // query is
"name=JamesBond&age=31", name was preserved, age was updated
$query = new HttpQueryString(false, 'age=31'); // query is "age=31"
?>
Second argument can be string and associative array, same as for HttpQueryString->set() method.
--was--
Note about first argument when calling the constructor:
â if true, instance will have initially exactly same query string as PHP received when user
accessed the page
â if false, instance will be empty.
<?
// Imagine that user puts âtest.php?name=JamesBond&age=30â into browser, thenâ¦
$query = new HttpQueryString(); // query is âname=JamesBond&age=30â. (First argument
is true by default.)
$query = new HttpQueryString(false); // query is empty
$query = new HttpQueryString(true, 'age=31'); // query is
âname=JamesBond&age=31â, name was preserved, age was updated
$query = new HttpQueryString(false, 'age=31'); // query is âage=31â
?>
Second argument can be string and associative array, same as for HttpQueryString->set() method.
http://php.net/manual/en/function.httpquerystring-construct.php