+1  A: 

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
yes, but can't you wrap function declarations in `if` statements?
Earlz
@Earlz : yeah, i read about this. it's about function declaration inside a function, isn't ?
justjoe
@Earlz: PHP tries to parse first, run second, but when it sees a function inside something like an `if` statement, it is forced to leave parsing the function for later and handle it on the fly. You will note that `<?php foo(); if(true) { function foo() { echo 'bar'; } } ?>` fails for that reason.
Matchu
Correct - as Matchu said, PHP special-cases functions which are declared inside conditional blocks; normally it tries to parse everything before evaluating it.
Amber
+1  A: 

PHP functions can be called before they are defined because it is parsed and then executed.

Kevin
+1  A: 

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

xentek