On Tue, 2006-04-11 at 23:15, Martin Alterisio "El Hombre Gris" wrote:
> Well, it was a bad example to begin with, first of all max() is already
> defined in php, I should at least checked that before posting. Second, I
> forgot PHP (the Zend engine) has an interesting way of handling
> variables, when you copy assign a var or pass it as an argument of a
> function, a real copy is not made but a reference. When you modify the
> reference, an actual copy is made before the modification. What's
> happening with the function you posted is that the variables are not
> passed by copy but by reference, that's why it works. Anyway, this is
> due to conditions on the way PHP (the Zend engine) handles its internal,
> you shouldn't rely on this in your code.
>
> http://www.zend.com/zend/art/ref-count.php
More popularly known as "copy-on-write". Wikipedia does a good job of
explaining the virtues:
http://en.wikipedia.org/wiki/Copy-on-write
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php