0

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

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

4 Comments

How does something like HipHop PHP fit into this?
@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.
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++?!
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.
4

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.