- var_dump: documentation ( source)
<?php
class A {
private $x;
public function __construct($v) {
$this->x = $v;
}
public function getIncrementor() {
return function() { return ++$this->x; };
}
}
$a = new A(1);
$b = $a->getIncrementor();
var_dump($b());