Home > Backend Development > PHP Tutorial > 如何打印出这个this的原形呢

如何打印出这个this的原形呢

WBOY
Release: 2016-06-23 14:39:32
Original
933 people have browsed it

本帖最后由 lghyt1 于 2013-12-14 16:03:30 编辑

<?phpclass A{    public $name;    public $age;    public function  getASelf() {        $this->name;        var_dump($this);    }}?>
Copy after login

突然对this的原形好奇,如何打出它的原形呢

回复讨论(解决方案)

实例化Class A,调用getASelf()
或者
实例化后即
$a = new A();

var_dump($a);

原来对象是这玩意object(A)#1 (2) { ["name"]=> NULL ["age"]=> NULL } 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template