Re: another religious issue, was [PHP] Require() vs Include()
| From: | Richard Lynch | Date: | Tue, 14 Nov 2000 22:16:16 +0000 |
| Subject: | Re: another religious issue, was [PHP] Require() vs Include() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25287@lists.php.net to get a copy of this message | ||
> I always put brackets in even when there's only one statement cause
> it makes it much easier to read/maintain. But so many people seem
Yes.
> not to use brackets that I wonder: is there a disadvantage to using
> brackets (apart from a few keypresses more)?
Not a measurable difference, unless you are executing the code a zillion
times. Readability wins over performance for 90% of your code anyway.
> On a similar note, I've read somewhere that use of the "condensed" if/else
> assignment ( ? : ) construct was recommended over the "normal" if/else
when
> there's only one assignment in the test. Again, that makes life less easy
> for
> whoever comes and needs to extend your code, especially if the expressions
> tested and assigned are non trivial, so I only use it when it's really
> obvious.
I find the trinary operator easier to read once you know how it works.
YMMV.
> Yet I wonder, does it makes a performance difference?
Performance is irrelevant for all but 10% of your code in the tightest loop
on the busiest page.