title: How to Check whether the function is called for the last time in PHP
body: <p>I Want to check whether a function is called for the last time. Consider the following sample code, </p>
  
  <pre><code>function foo(){
      if( this is the last call ) {
           echo 'this is the last call of this function';
      }
  }
  
  foo(); // should not print
  foo(); // should not print
  foo(); // since this is the last call, it should print
  </code></pre>
  
  <p>In my project, i need the condition statement to be present within the function.</p>
  
  <p>I had a idea of using constants/global variables/counters but don't no how to implement.Any ideas to detect the last call of the function ?</p>