[dev] [commits] Horde branch master updated. 8fb392db7dd8fa42dd7a759be11b1628ee5a7e39
Jan Schneider
jan at horde.org
Sat Sep 10 14:44:08 UTC 2011
Zitat von Michael M Slusarz <slusarz at horde.org>:
> Quoting Jan Schneider <jan at horde.org>:
>
>> Zitat von Michael M Slusarz <slusarz at horde.org>:
>>
>>> commit 4797d5ac1c99268d489462c06c1d0404f00d29fa
>>> Author: Michael M Slusarz <slusarz at curecanti.org>
>>> Date: Fri Sep 9 17:23:08 2011 -0600
>>>
>>> Some places where we can use references instead of copy-by-value
>>>
>>> framework/Mime/lib/Horde/Mime.php | 8 ++++----
>>> framework/Mime/lib/Horde/Mime/Address.php | 2 +-
>>> 2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> This doesn't make sense. PHP does copy-on-write, so it doesn't
>> matter if use references or copy-by-value. If you want to avoid
>> copying the value into a new variable during the loop, you should
>> rather loop over the keys instead (if those are really arrays, not
>> iterators).
>
> A further note:
>
> These are example of PHP internals that should be (and are)
> transparent to someone programming in the language. But the problem
> is that the consequences of these internal decisions drastically
> affect the performance of a particular script. The pro and con of a
> high-level programming language.
>
> It would be nice if there was a place where some of these internals
> were documented as they relate to aiding in a PHP programmer. Does
> anyone know of such a site (besides random scattered comments within
> the PHP manual itself)?
CODING_STANDARDS ;-) We always tracked such kind of stuff there, but
the problem is that such user-land optimizations of internal PHP
behavior tend to fall on the (high level language) developer's feet at
one point, because the (low-level) behavior might change at any time,
making workarounds useless, or even worsening things. This happened
with PHP already, especially with regard to references.
Jan.
--
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
More information about the dev
mailing list