include() within function - making included vars global?
Posted: Thu Jan 22, 2004 9:08 am
Hello,
I have a "customised" include function that records information every time a file is included. A basic boiled down version is:
The included files add all manner of variables to the main script. The problem comes with the fact they are included as local variables for the function, when they are needed outside.
Is there any way of "setting" a function to treat all internal variables, including newly declared ones, as globals?
Any hints whatsoever would be greatly appreciated.
I have a "customised" include function that records information every time a file is included. A basic boiled down version is:
Code: Select all
function include_custom($include) {
global $include_count;
$include_count++;
include($include);
}Is there any way of "setting" a function to treat all internal variables, including newly declared ones, as globals?
Any hints whatsoever would be greatly appreciated.