I am trying to get figure this out and haven't been able to. I'm trying to create a function that will include different config files into the script when needed. I want to store all the variables in arrays and then use a function to include them.
Example
Config.php
$array = array(
'var1' => 'something',
'var2' => 'something else'
);
uses.php
class uses{
      public static function file($directory, $file){
        if(is_dir($directory))
        {   
            if(is_file($directory.$file))
            {        
           include $directory.$file;
            }
            else
            {
             echo "File Not Found $directory$file";
            }
        }
        else
        {
           echo 'Dir Not Found';
        }
    }
}
index.php after I've included uses the file
uses::file(Config.php);
print_r($array);
I know if you include a file inside a function they won't reach past the scope of the function. This would be loaded in by an auto loader so I would be able to use it anywhere inside my script.
Thanks in advance, if you need any more information please let me know.
 
     
    