$someValue = "sample external data"; $simpleClosure = function() use($someValue) { return "Test accessing external value inside closure ".$someValue; }; echo $simpleClosure();