PHP files are run in two stages.
First, the PHP files are parsed. At this point, the data coming from the web browser (or from any other source) is utterly irrelevant. All this does is break the PHP file down into its constituent parts and building the structure of the code.
Then the code is executed with the data you supply.
This separation makes the code a very great deal faster. This is especially true when you have opcode caches like APC or OPcache, because the first step can be skipped on subsequent occasions because the structure of the code is exactly the same.
The time when you will encounter the difference is principally with errors. For instance, this code will cause an error at the compiling stage:
function class() {
// some code
}
This is not possible because class
is a reserved word. PHP can pick this up at the time the code is compiled: it will always fail. It can never work.
This code, however, could cause an error at runtime:
echo $_GET['nonExistingKey'];
Since the key nonExistingKey
doesn't exist, it can't be retrieved, so it causes an error. However, PHP can't decide this when the code is originally compiled, only when it is run with the data you supply.