title: Use of __clone in PHP?
body: <p>I have a class a and instantiated it using new</p>
  
  <pre><code>$obja = new a;
  </code></pre>
  
  <p>I know the difference between the below two lines</p>
  
  <pre><code>$obja2 = $ojba;
  $obja2 = clone $obja;
  </code></pre>
  
  <p>But even if you declare or not declare __clone in the class a the first line $obja2 refer to $obja memory space and second line creates a copy of the $obja. Till here it is clear to me.</p>
  
  <p>Then why php is having a magic method __clone?
  Is it only for executing a set of codes which is written inside __clone while we use $obja2 = clone $obja;</p>
  
  <p>Somebody please help to get a better idea of it.</p>