Nathanael Nathanael - 1 year ago 78
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download