Read: http://www.php.net/variables.scope
Also note that $_SERVER is an autoglobal. Regards, Philip On Sun, 26 Jan 2003, @ Nilaab wrote: > Hello Everyone, > > I am a little confused. Why do predefined variables like $PHP_SELF or > $DOCUMENT_ROOT not process within a class, in the methods secifically. For > example: > > <?php > class someClass { > > function someFunction () { > $root = $DOCUMENT_ROOT; > return $root; > } > > function someFunction2 () { > $path = $this->someFunction() . $PHP_SELF; > return $path; > } > } > ?> > > I just threw this together to give you an example of how I might be using > these two predefined variables in a class. The problem is that > $DOCUMENT_ROOT or $PHP_SELF won't parse or something. It just returns blank. > > It is included in another page when needed, say somePage.php. Shouldn't > $PHP_SELF recognize the somePage.php as the current running script file, as > opposed to the class file where these two functions are called? If it > doesn't work that way then how do I do this without sending predefined > variable parameters to these functions? > > Please note that register globals is on. I could not find any documentation > on this on php.net. Maybe someone can give me a hint of point it out for me > on the documentation. Thanks. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php