I've got, lets say, index.php. Index.php includes global.php which initiates certain stuff and holds my special include function:
function incFunc($names)
{
$incfunc = array('ICONS' => 'functions/icons.php',
'DATES' => 'functions/dates.php',
'GENERAL' => 'functions/general.php',
);
if(is_array($names))
{
foreach($names as $name)
{
$name = strtoupper($name);
foreach($incfunc as $incname => $incfile)
{
if($name == $incname)
{
include($incfile);
unset($incfunc[$incname]);
break;
}
}
}
}
else
{
$names = strtoupper($names);
foreach($incfunc as $incname => $incfile)
{
if($names == $incname)
{
include($incfile);
unset($incfunc[$incname]);
break;
}
}
}
}
Then if I need some icon and date functions, I call up the my include function and pass it what I need:
incFunc(array("dates","icons"));
So is the array from icons.php getting scoped to just incFunc()?