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
2010-06-04 03:22:38
@Amber, How does something like HipHop PHP fit into this?
Inkspeak
2010-06-04 03:29:50
@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
2010-06-04 03:53:00
@Inkspeak my fault. I was just being silly. removed.
Typeoneerror
2010-06-04 04:00:37
@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
2010-06-04 12:39:48
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
2010-06-04 17:13:26
+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
2010-06-04 03:28:50