I'm wondering about order of interpreting function declarations by PHP engine. I don't know why somethimes PHP shows Call to undefined function fatal error and somethimes interpreter see the function without problem.
Let's suppose my code is:
echo theRest(4,3);
function theRest($a, $b)
{
return $a % $b;
}
See that function is declared after invocation and this works proper. It means that PHP reads whole file before interpretation?
Another example:
echo theRest(4,3);
include('test2.php');
test2.php
function theRest($a, $b)
{
return $a % $b;
}
Here i'm getting the Fatal error: Call to undefined function theRest(). Why is that?