title: PHP, return class as object
body: <p>I am testing the way writing PHP like js, and I wonder if this will be possible.</p>
  
  <p>If say I have A, B function in Class C.</p>
  
  <pre><code>Class C{
     function A(){
  
     }
     function B(){
  
     }
  }
  $D = new C;
  
  $D-&gt;A()-&gt;B(); // &lt;- Is this possible and how??
  </code></pre>
  
  <p>In Js, we can simple write <code>like D.A().B();</code></p>
  
  <p>I tried <code>return $this</code> inside of <code>function A()</code>, didnt work.</p>
  
  <p>Thank you very much for your advice. </p>