- var_dump: documentation ( source)
<?php
class A {
protected $_b = 'protected';
private $_c = 'private';
}
$method = function (){ var_dump($this->_b, $this->_c);};
$a = new A;
$a->newMethod = $method->bindTo($a, 'A');
$a->newMethod();
var_dump($a);