title: PHP: get_called_class() vs get_class($this)
body: <p>In PHP what is the difference between <a href="http://php.net/manual/en/function.get-called-class.php" rel="noreferrer"><code>get_called_class()</code></a> and <a href="http://php.net/manual/en/function.get-class.php" rel="noreferrer"><code>get_class($this)</code></a> when used inside an instance?</p>
  
  <p>Example:</p>
  
  <pre><code>class A {
      function dump() {
          echo get_called_class();
          echo get_class($this);
      }
  }
  
  class B extends A {}
  
  $A = new A();
  $B = new B();
  
  $A-&gt;dump(); // output is 'AA'
  $B-&gt;dump(); // output is 'BB'
  </code></pre>
  
  <p>Is there any difference in this case?</p>
  
  <p>When should I be using one or the other <code>get_called_class()</code> or <code>get_class($this)</code>?</p>