> Was just wondering how to do the following:
>
> <?php
> class Foo {
>
> var $bar = $foo; // causes parse error
> var $bar = "$foo"; // causes parse error
> var $bar = '$foo'; // works but $foo is not evaluated
>
> }
> ?>
>
> So how does one correctly assign a variable to a variable inside a class
withot doing something like:
>
> var $bar = '';
> $this->bar = $foo;
>
> Any insight would be much appreciated.
I was curious too, so I looked it up. Seems you can't. From
http://www.php.net/manual/en/language.oop.php
"Note: In PHP 4, only constant initializers for var variables are
allowed. Use constructors for non-constant initializers."
Hope this helps,
Joe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]