svn: /phpdoc/en/trunk/reference/url/functions/ http-build-query.xml

From: Date: Thu, 19 Aug 2010 09:28:50 +0000
Subject: svn: /phpdoc/en/trunk/reference/url/functions/ http-build-query.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-7015@lists.php.net to get a copy of this message
rquadling Thu, 19 Aug 2010 09:28:50 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=302467 Log: Changed the data paramater from $formdata to $query_data Documented that only public properties are accessed. Updated example to show nested objects. Fix bug#52638 Bug: http://bugs.php.net/52638 (Assigned) Misleading parameter name for http_build_query Changed paths: U phpdoc/en/trunk/reference/url/functions/http-build-query.xml Modified: phpdoc/en/trunk/reference/url/functions/http-build-query.xml =================================================================== --- phpdoc/en/trunk/reference/url/functions/http-build-query.xml 2010-08-19 06:04:47 UTC (rev 302466) +++ phpdoc/en/trunk/reference/url/functions/http-build-query.xml 2010-08-19 09:28:50 UTC (rev 302467) @@ -10,7 +10,7 @@ &reftitle.description; <methodsynopsis> <type>string</type><methodname>http_build_query</methodname> - <methodparam><type>array</type><parameter>formdata</parameter></methodparam> + <methodparam><type>mixed</type><parameter>query_data</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>numeric_prefix</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>arg_separator</parameter></methodparam> </methodsynopsis> @@ -25,15 +25,20 @@ <para> <variablelist> <varlistentry> - <term><parameter>formdata</parameter></term> + <term><parameter>query_data</parameter></term> <listitem> <para> May be an array or object containing properties. </para> <para> - The array form may be a simple one-dimensional structure, or an array - of arrays (who in turn may contain other arrays). + If <parameter>query_data</parameter> is an array, it may be a simple + one-dimensional structure, or an array of arrays (which in + turn may contain other arrays). </para> + <para> + If <parameter>query_data</parameter> is an object, then only public + properties will be incorporated into the result. + </para> </listitem> </varlistentry> <varlistentry> @@ -113,12 +118,19 @@ 'cow'=>'milk', 'php'=>'hypertext processor'); -echo http_build_query($data); // foo=bar&baz=boom&cow=milk&php=hypertext+processor -echo http_build_query($data, '', '&amp;'); // foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor +echo http_build_query($data) . "\n"; +echo http_build_query($data, '', '&amp;'); ?> ]]> </programlisting> + &example.outputs; + <screen> +<![CDATA[ +foo=bar&baz=boom&cow=milk&php=hypertext+processor +foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor +]]> + </screen> </example> <example> @@ -189,23 +201,39 @@ <programlisting role="php"> <![CDATA[ <?php -class myClass { - var $foo; - var $baz; +class parentClass { + public $pub = 'publicParent'; + protected $prot = 'protectedParent'; + private $priv = 'privateParent'; + public $pub_bar = Null; + protected $prot_bar = Null; + private $priv_bar = Null; - function myClass() { - $this->foo = 'bar'; - $this->baz = 'boom'; + public function __construct(){ + $this->pub_bar = new childClass(); + $this->prot_bar = new childClass(); + $this->priv_bar = new childClass(); } } -$data = new myClass(); +class childClass { + public $pub = 'publicChild'; + protected $prot = 'protectedChild'; + private $priv = 'privateChild'; +} -echo http_build_query($data); // foo=bar&baz=boom +$parent = new parentClass(); +echo http_build_query($parent); ?> ]]> </programlisting> + &example.outputs; + <screen> +<![CDATA[ +pub=publicParent&pub_bar%5Bpub%5D=publicChild +]]> + </screen> </example> </refsect1>

« previous php.doc.cvs (#7015) next »