* Skrol29 <[EMAIL PROTECTED]>:
> It's seems to be allowed to add a new property (a member ?) to an object
> instance in both PHP 4 and 5.
> For example:
> **************************
> class Test {
>   var $Prop1 = 'anything';
> }
> $MyObj = new Test;
> $MyObj->Prop2 = 'hello';
> **************************
>
> But I can't found any documentation saying that it's offcially supported or
> not.
> Do you have any information about this ?
> Do you often use added properties ?

I know that it's allowed, but now that I look through the official docs,
I don't see where that behaviour is explicitly made clear. But yes, you
can add properties on the fly at any time -- which is why it's good to
declare any that you KNOW will be used in the class via the 'var'
declarations. That way you have at least documented that those are
reserved.

-- 
Matthew Weier O'Phinney           | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

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

Reply via email to