Re: help with classes
| From: | Joseph H Blythe | Date: | Wed, 14 Feb 2001 04:42:10 +0000 |
| Subject: | Re: help with classes | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39335@lists.php.net to get a copy of this message | ||
On Mon, 12 Feb 2001 20:11:14 -0800
Joe wrote:
JC>
JC> I was curious too, so I looked it up. Seems you can't. From
JC> http://www.php.net/manual/en/language.oop.php
JC>
JC> "Note: In PHP 4, only constant initializers for var variables are
JC> allowed. Use constructors for non-constant initializers."
JC>
JC> Hope this helps,
JC>
JC> Joe
JC>
I missed that one little cryptic note :-)
I basically just made a function that sets the var variable to what I wanted. Unless *anyone* knows
a better way?
class Foo {
var $bar;
function setBar($bar) {
this->bar = $bar;
}
}
Thanks for your help!
Regards,
Joseph