title: scope of function defined within function in PHP
body: <pre><code>&lt;?php
  function foo()
  {
      function bar()
      {
          echo &quot;this is bar&quot;;
      }
  }
  
  bar();
  // Error occurs becauase function 'bar' has not been defined
  
  foo();
  //execute 'foo' function.
  
  bar();
  //execute 'bar' function defined in foo function.
  //How is it possible?
  ?&gt;
  </code></pre>
  <p>In the above code, I thought function 'bar' will be get rid from memory after finishing 'foo' routine, but i found it is working. How is it possible?</p>