<?php
class OS {
var $name;
function OS($name) {
$this->name = $name;
}
}
function changeName($obj, $name) {
$obj->name = $name;
}
$linux = new OS('linux');
$win = clone $linux;
changeName($win, 'windows');
echo $linux->name, "\n", $win->name;
?>
In PHP 4 $object2 = $object1 creates a copy of the object.
In PHP 5 $object2 = $object1 creates a reference to the object
unless clone is used or zend.ze1_compatibility_mode = 1.