note 108316 deleted from function.http-build-query by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 13:45:38 +0000 |
| Subject: | note 108316 deleted from function.http-build-query by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189782@lists.php.net to get a copy of this message | ||
Note Submitter: aanter at yahoo dot com
----
calling http_build_query from inside a class using $this as object reference will produce output
including protected and private members as well as public members.
<?php
class Page
{
public $var1;
protected $var2;
private $var3;
function __construct(){
$this->var1='a';
$this->var2='b';
$this->var3='c';
}
function url(){
echo ( http_build_query($this));
}
};
$o=new Page;
$o->url();
?>
the output will be
var1=a&var2=b&var3=c