RE: [PHP] $DOCUMENT_ROOT -- didn't work from a class..

From: Date: Wed, 30 Aug 2000 08:54:42 +0000
Subject: RE: [PHP] $DOCUMENT_ROOT -- didn't work from a class..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-14348@lists.php.net to get a copy of this message
Maxim Maletsky wrote:
I think I fixed my own problem: i tried getenv($DOCUMENT_ROOT) and it worked, Thanks to anyone who tried to solve it or just thought 'bout it. now, just for my own education, why did it happened? was there a reason for it? was there anything else to do? Thank you ALL!
Now, what I want to know is why this works: <?php class Foo { function Bar() {
      return $GLOBALS['DOCUMENT_ROOT'];
} } $obj = new Foo; print $obj->Bar(); ?> But this doesn't: <?php class Foo { var $docRoot = $GLOBALS['DOCUMENT_ROOT']; function Bar() {
      return $docRoot;
} } $obj = new Foo; print $obj->Bar(); ?> Brian

« previous php.general (#14348) next »