<?php
require_once 'Defer.php';
function foo() {
$bar = "some-handle";
$defer = new Defer();
$defer->nullify($bar);
echo $bar . PHP_EOL;
}
foo();
function baz(&$x) {
$defer = new Defer();
$defer->run(function () use(&$x) {
echo " rocks!" . PHP_EOL;
$x = null;
});
echo $x;
}
$x = "defer";
baz($x);
var_dump($x);
|