PHP4 Object handling vs PHP5

From: Chung Leong (chernyshevsky_at_hotmail.com)
Date: 11/09/03


Date: 9 Nov 2003 14:47:50 -0800

Help me here. I've become a bitconfused about how PHP4 deals with
objects after reading this description of PHP5:

"PHP's handling of objects has been completely rewritten, allowing for
better performance and more features. In previous versions of PHP,
objects were handled like primitive types (for instance integers and
strings). The drawback of this method was that semantically the whole
object was copied when a variable was assigned, or pass as a parameter
to a method. In the new approach, objects are referenced by handle,
and not by value (one can think of a handle as an object's
identifier)."

I have always assumed that PHP4 uses a copy-on-write approach, so that
when you pass an object to a function by value, PHP doesn't actually
create a new copy of that object.