title: include php file using a function
body: <p>Inside index.php I need to include files using a php method from inside a class. </p>
  
  <p>I'm calling the method, several times, on index.php and that method is doing include_once or require_once. The problem is that my first included file, is creating some variables which must be seen inside all the files, the rest of the included files as well as inside the index.php file. 
  Since I'm using a method to include the files, the variable generated on each file are visible only inside the function.
  I can't use $this->var_name and I don't want to make them global as well. Not sure if global will do any good. I tested global and seems it's not working.
  I manage to make the variables visible inside all the included files by making them static inside the include method, but I can't make them visible inside the index.php file as well.</p>
  
  <p>Inside index.php I have this</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;?php $this-&gt;Import($filemane);?&gt;
  &lt;/head&gt;
  &lt;body id="stylef&lt;?php echo $default_font_family ?&gt;"
  </code></pre>
  
  <p>and inside Import method I'm including the $filename file. On $filename file, first included file, I'm creating some vars ($default_font_family and more) that needs to be visible inside index.php file as $default_font_family and $css_file not $this->default_font_family or ClassName::var and so on...I must keep them as $default_font_family.
  On index.php I also call the Import method for more files and inside those files I also need to call the variables, defined in first included file, as $default_font_family and not $this->$default_font_family.
  The only solution I found for this, is to create the variables as static inside the Import method and this way I can see them as $default_font_family inside all the included files. Is there any easier way for this?
  I can't manage to make the variables visible inside index.php file now. I'm getting Undefined variable: default_font_family inside index.php file.
  Any solutions?</p>