PHP files are parsed and then run, in two separate steps. The function is parsed before it is called, which gets rid of the need for forward declarations/prototyping.
Amber
2010-03-23 02:58:26
PHP files are parsed and then run, in two separate steps. The function is parsed before it is called, which gets rid of the need for forward declarations/prototyping.
PHP functions can be called before they are defined because it is parsed and then executed.
Functions are evaluated before they are called. Since the function is in the same file, both function calls are valid and point to the function you've defined.
There are exceptions to this, if you've defined a function inside another function, or if you wrap them in conditional statements, but the code you supplied is most perfectly valid.
More Info: http://www.php.net/manual/en/functions.user-defined.php