<?php
class Baby {
private $height = 5.9;
public function __construct() {
}
public function __toString() {
return strval($this->height);
}
public function __clone() {
// mutation!
$this->height = 4.5;
}
}
echo $Julius = new Baby();
echo $Vincent = clone $Julius;
?>
class Baby {
private $height = 5.9;
public function __construct() {
}
public function __toString() {
return strval($this->height);
}
public function __clone() {
// mutation!
$this->height = 4.5;
}
}
echo $Julius = new Baby();
echo $Vincent = clone $Julius;
?>