- var_dump: documentation ( source)
- error_reporting: documentation ( source)
<?php
error_reporting(E_ALL);
$var = new StdClass();
$var->foo = 'bar';
//$this = $var; // PHP Fatal error: Cannot re-assign $this
$GLOBALS['this'] = $var;
var_dump($this);
$var->foo = 'baz';
$foo = 'this';
$$foo = $var;
var_dump($this);
foo($this);
function foo($this){
//global $this; // PHP Fatal error: Cannot re-assign $this
// $this = $GLOBALS['var']; // PHP Fatal error: Cannot re-assign $this
var_dump($this);
$GLOBALS['this']->foo = 'baw';
$$GLOBALS['foo'] = $GLOBALS['this'];
var_dump($this);
}