How can I force the execution of a PHP file in a global scope? -


i have php file, include.php has following contents:

<?php $myvar = "foo"; ?> 

now, want create class, called globalinclude, can include file in global scope:

class globalinclude {     public function include( $file="include.php" ) {         #do smart         include $file         #do smart     } } 

in it's current form, $myvar variable available inside scope of include function. want like:

globalinclude::include( "include.php" ); echo $myvar; 

output foo

any ideas on how can accomplish this?

see php: "global" include.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -