If you simply reassign an object in PHP5, you're giving it a second name for the same piece of data, but if you clone it, you're producing a new copy of the same data. In this example, we create a "dog" object with a name of Gypsy, copy it one and clone it one to give us three names. We then change the name of the original to "Arthur". Asking for the dog's name through all three variables then gives us 2 "Arthur"s - the original and the assigned copy, and 1 "Gypsy" - the cloned copy

Arthur
Arthur
Gypsy



Training sample © 2024, WELL HOUSE CONSULTANTS LTD
This is http://www.wellho.net/demo/litter.php
See source code here • More examples - same topic here
Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
Phone: +44 (0) 1225 708 225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net