I’ve been using the following snippet to include multiple files:
foreach(glob(APP_PATH."libs/*.php") as $path)
{
include $path;
}
The thing is, I don’t want to have the $path variable available inside the included files.
Fictitious solution:
include unset($path);
This would have worked if unset returned the value of the unsetted variable. It doesn’t though. It returns void.
You could write your own
unsetthat returns the value…function unsetr(&$value) { $result = $value; unset($value); return $result; }