Re: Imap Backend Propsal
| From: | Bertrand Mansion | Date: | Thu, 29 Jan 2004 22:16:34 +0000 |
| Subject: | Re: Imap Backend Propsal | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25339@lists.php.net to get a copy of this message | ||
<chuck@horde.org> wrote :
> Quoting Richard York <richy@smilingsouls.net>:
>
>> I've been doing OOP for about a year or so and still regularly run
>> into stuff that I didn't know about before, how can I declare
>> variables dynamically? Do I not have to declare a variable with the
>> var keyword before using it?
>
> You don't have to, but IMHO you definitely should. It makes absolutely sure to
> avoid errors when running in E_ALL error reporting mode, is good practice, and
> helps people reading the code know what to expect (also gives you a good place
> to document what you're putting into those vars).
Dynamically instantiating vars does not trigger a notice even in E_ALL mode,
that's an exception to the rule. I agree that it makes reading your code
easier but in this special case where headers contents might be different
from one mail to another (Spam-Level, Spam-Flag, etc) it makes sense not to
try to have all of them declared.
It is interesting though to have the smallest common denominator declared
just to be sure those values are available.
Bertrand Mansion
Mamasam