I understand the why $vars is not in the global scope, but i was
wondering if there was a way from within the class file to include a
file in the parent's scope?

i tried ::include('vars.php'), parent::include('vars.php'), but this
breaks syntax...

Please consider the following three files:

class CScope {
        public $var = 'class scope\n';
        function cinclude($filename) {
                echo "In class $vars\n";

//global $vars;//if this line is uncommented then the desired result is
achieved however, i don't want to change all the variables to global
scope (this file is includeded in other files where global scoped
variables is not desireable).
$vars = 'vars.php scope\n';

$object = new CScope;
echo "In original $vars\n";//$vars is not defined***


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to