Re: how to mark protected properties?

From: Date: Tue, 08 Jun 2004 13:33:03 +0000
Subject: Re: how to mark protected properties?
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30164@lists.php.net to get a copy of this message
Bertrand Mansion wrote:
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.
Let's talk with some code then, 10 times slower is not a performance problem? Tomas V.V.Cox

« previous php.pear.dev (#30164) next »