$variable; functionName($someArgument, function() use(&$variable) { $variable = "something"; }); this is called closure;