title: php detect function is called
body: <p>I dont know how to explain this question so maybe the tile is not matched.</p>
  
  <pre><code>    Class a {
         function b{
           return $this;
         }
         function c{
           return $this;
         }
      }
  </code></pre>
  
  <p>If I have class structure like this I can do </p>
  
  <pre><code>$a = new a();
  $a-&gt;b()-&gt;c();
  </code></pre>
  
  <p>I want to know how can I know the function is not continued like <code>$a-&gt;b();</code>, then I return $retuslt instead of $this.</p>
  
  <pre><code>Class a {
     function b{
  
       //if not continued
       return $result;
  
       //if continued
       return $this;
  
     }
     function c{
       return $this;
     }
  }
  </code></pre>
  
  <p>Is this possible? thank you very much!!</p>