Chris Boget wrote:
I believe you can make the property static (at least in PHP5):
class MyClass
{
public static $myClassVar = "Bob";
}
echo MyClass::$myClassVar; // Bob


Unfortunately, in PHP4.3.2 that doesn't seem to be working... :(
Does anyone know how I can access a class' variable w/o having
to instantiate an object of the class?  This is more to the point of
what I'm trying to do:

Since PHP4 doesn't have enums, I'm doing this:

class MyEnums {
  var $this = 'This';
  var $that = 'That';
  var $other = 'Other';
}

class MyClass {
  var $MyVar = MyEnums::$this;
}

But obviously, that's not working.  Is there a way I can get
it to work?

thnx,
Chris

class MyEnums { var $this = 'This'; var $that = 'That'; var $other = 'Other'; }

 class MyClass {
   var $MyVar = MyEnums::this;
 }

reference like MyClass::MyVar. Don't use PHP5 conventions in PHP4!

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



Reply via email to