|
Posted by Thomas Mlynarczyk on 05/18/06 21:48
Also sprach Erwin Moller:
> Passing by reference is faster, because normal passing involves a
> complete copy of the variable.
No. See http://www.zend.com/zend/art/ref-count.php
Quote: "Note that PHP 4 is not like C: passing variables by reference is not
necessarily faster than passing them by value. Indeed, in PHP 4 it is
usually better to pass a variable by value, except if the function changes
the passed value or if a reference ... is being passed."
PHP simply creates another entry in the symbol table pointing to the same
stored value and does not copy it until one of the variables is actually
changed. Thus, references would not necessarily be faster.
Greetings,
Thomas
Navigation:
[Reply to this message]
|