title: Object copy versus clone in PHP
body: <p>Consider the following:</p>
  
  <pre><code>$object1 = new stdClass();
  $object2 = $object1;
  $object3 = clone $object1;
  
  $object1-&gt;content = 'Ciao';
  
  var_dump($object1);
   // Outputs object(stdClass)#1 (1) { ["content"]=&gt; string(4) "Ciao" }
  var_dump($object2);
   // Outputs object(stdClass)#1 (1) { ["content"]=&gt; string(4) "Ciao" }
  var_dump($object3);
   // Outputs object(stdClass)#2 (0) { }
  </code></pre>
  
  <p>Is it a normal PHP behavior that <code>$object2</code> has a content identical to <code>$object1</code> ?</p>
  
  <p>To me it sound like <code>$object2</code> is a reference to <code>$object1</code> instead of a copy.
  Cloning the object before changing the content does act like a copy.
  This behavior is different than what happens with variables and seems unintuitive to me.</p>