I have a php file, say include.php, which has the following contents:
<?php $myVar = "foo"; ?>
Now I want to create a class called GlobalInclude that can include a file in the global scope:
class GlobalInclude { public function include( $file="include.php" ) {
In the current form, the variable $ myVar will be available only inside the scope of the include function. I want to do something like:
GlobalInclude::include( "include.php" ); echo $myVar;
Exit foo
Any ideas on how I can do this?
source share