<?php
class OS {
var $name;
function OS($name) {
$this->name = $name;
}
}
function changeName(&$obj, $name) {
$obj->name = $name;
}
$linux = new OS('linux');
$win = $linux;
changeName($win, 'windows');
echo $linux->name. "<br />\n";
echo $win->name;
?>
<?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";
echo $win->name;
?>