Quote Originally Posted by felgall View Post
This entire discussion has gone off course because PHP is NOT an interpreted language - it is a compiled language.

It isn't comiled just once though with all subsequent accesses using the compiled version. It is compiled every time someone accesses the web page and the compiled version is run just for that one access and is then discarded with the script being compiled all over again when the page is next referenced.

This is known as a Just in Time compile process (or JIT).
While everything Felgal says here is true - I still would consider PHP a hybrid. In my opinion, any language which has run time evaluation -- an eval() statement -- is almost certainly interpreted and can be called an 'interpreted' language because for all practical purposes it is.

Also, while simple parse errors are caught at the compile pass - symbol table mismatches, such as calls to non-existent functions aren't caught until the line tries to actually execute. In this manner PHP behaves more like an interpreted language than a compiled one. Java after all also uses JIT compiling from the bytecode to the final executable, but it catches many errors at compile time PHP does not. Java also does not have any eval capacity.

Finally, as far as optimization goes, if APC cache or similar mechanism is present PHP can hold the bytecode between page requests and that code can persist for the lifetime of the cache, which has enormous returns in execution speed.