tags:

views:

73

answers:

2

Can you tell me what are the process in a php file compilation.

+4  A: 

PHP files are usually interpreted, not compiled - the interpreter compiles them internally to bytecode, but that is something done automatically when a script is invoked, not something done by the programmer.

Amber
@Amber, How does something like HipHop PHP fit into this?
Inkspeak
@Inkspeak: HipHop translates PHP into C++, and then compiles that. Thus, it doesn't actually compile the PHP itself, but rather C++. The most common use case for PHP, however, is definitely still interpreted/internal-bytecode.
Amber
@Inkspeak my fault. I was just being silly. removed.
Typeoneerror
@Amber, Thank you. That's pretty interesting. So, I did a little more reading on HipHop. It seems to me that it's definitely a niche use and presumes a more limited PHP usage. I wonder why people don't just use C++?!
Inkspeak
Because various languages are designed to be easier to use for certain things. PHP is designed as a HTML preprocessor, and thus is often efficient for many of the things that need to be done for web pages. C++ is not, by default.
Amber
+3  A: 

Actually surprised to see how many compilers there are out there. @learner, you might want to check out http://en.wikipedia.org/wiki/PHP#Compilers for some more info. Seems like there are a number of different compilers that compile to bytecodes java, c++, et al. Facebook notoriously compiles their PHP to C++ and machine now as well.

Typeoneerror