Re: Class declaration, constants and array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2005-01-28 at 14:50, Marek wrote:
> php5 class {
> 
>     const _SOMETHING_ = 'test';
> 
>     private $abc=_SOMETHING_;      // fails, well actually anything fails
> similar to this.
>     var $test=$test2;                    // also fails
> 
> So since I can not use dynamic var assignment within the class declaration,
> what are some of the easy solutions to this ? without making anything global
> to the script ?
> 
> Thanks

I believe you will have to establish stuff like this in the
constructor.  jsut create a function the same name as the class and it
will be run on object instantiation.  I had to do the a couple of years
ago for an array.

Check out the manual it used to explain this.
Bret

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux