- var_dump: documentation ( source)
<?php
class A {
private $p1 = "secret";
public function B() {
var_dump($this);
${'t' . 'his'} = 'hidden'; // works
var_dump($this);
var_dump($GLOBALS['this']); // class is global but $this is not since only refers to this particular object.
$GLOBALS['this'] = 'lovely';
var_dump($this, $GLOBALS['this']);
echo "$this {$this->p1}";
}
}
$a = new A;
$a->B();