- var_dump: documentation ( source)
<?php
class Kitchen
{
private $yummy = 'cake';
}
$sweetsThief = function & (Kitchen $kitchen) {
return $kitchen->yummy;
};
$kitchen = new Kitchen();
$sweetsThief = Closure::bind($sweetsThief, null, $kitchen);
$cake = & $sweetsThief($kitchen);
$cake = 'lie';
var_dump('the cake is a ' . $sweetsThief($kitchen));