Nathanael Nathanael - 3 months ago 24
PHP Question

PHP - Include files without inhereting variables?

Is it possible to include (or, for my uses, run) another PHP file from within a PHP script without inheriting the variables set in the parent script? I know this is mostly possible to do by wrapping the include in a function, but that feels sloppy.

Is there a more elegant alternative?


Unfortunately, at the time of this writing, it appears that wrapping what you want to include in a function or method is the only way to achieve this.