title: Call function within a function PHP
body: <pre><code>1    function foo($i){
  2       return bar($i)*4;
  3       function bar($i){
  4           return $i*4;
  5           }
  6       }
  7    echo foo(4);
  </code></pre>
  
  <p>return </p>
  
  <pre><code>Fatal error: Call to undefined function bar() in /var/www/index.php on line 2
  </code></pre>
  
  <p>why doesn't it work? it works well in javascript, while it works when i do this:</p>
  
  <pre><code>function foo($i){
     return bar($i)*4;
     }
  
  function bar($i){
     return $i*4;
     }
  </code></pre>