<?php
class my_class3 
  static 
$instances 0;
  public 
$instance;

  public function 
__construct() {
    
$this->instance = ++self::$instances;
  }
  public function 
__clone() {
    
$this->instance = ++self::$instances;
  }
}
$test = new my_class3;
$test2 = clone $test;
echo 
$test->instance;
echo 
"<br />\n";
echo 
$test2->instance;
?>
Output
1
2
Note that we are not overriding the cloning with our __clone() method. Think of it as a fixup that is called after the actual copy has been done.