Re: how to mark protected properties?
| From: | Bertrand Mansion | Date: | Tue, 08 Jun 2004 13:14:58 +0000 |
| Subject: | Re: how to mark protected properties? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30161@lists.php.net to get a copy of this message | ||
Tomas V.V.Cox wrote:
>Bertrand Mansion wrote:
>> Tomas V.V.Cox wrote:
>>
>>>IMHO, as silly as sounds to prefix all vars with '_', sounds to create
>>>dozen methods/calls for getting access to those protected vars.
>>
>>
>> If you are clever, all you need is 2 methods.
>> That's called key-value coding.
>
>Please read it again: "methods/calls" (replace "/" with "or"),
>specially
>the "calls". Now imagine the cost inside a > 100 loop, any basic php
>performance tutorial will tell you it.
I am not sure you understand what protected is ?
You can still do your > 100 loop with $this->foo = value if you need to.
If you need to do a > 100 loop somewhere outside your object, just pass the
values to iterate by reference as an array to your object and let it do the
assignment job. I don't see a performance problem with that. Maybe a less basic
tutorial could tell you about it.
Bertrand Mansion
Mamasam