I am in doubt after reading This Article. I had read on several forms and articles that php is an interpreted language, even i found the same thing with Stackoverflow but when i read it from here I got confused. Can anyone explain me about this with certain authenticated links or refrences.
Addition After 3 Comments:- The Article says:-
PHP became a compiled language in the year 2000, when PHP 4 was released for the first time. Until version 3, PHP source code was parsed and executed right away by the PHP interpreter.
Please Don't put your answers as such without having a look at the mentined article. I got the doubt after reading this article and i am much more courious about the content of this article,
It isn't.
The article you mention talks about HipHop which is Facebook's tool to compile PHP into C++ for faster execution.
Edit:
As explained in the article:
PHP became a compiled language in the year 2000, when PHP 4 was released for the first time. Until version 3, PHP source code was parsed and executed right away by the PHP interpreter.
The first phase parses PHP source code and generates a binary representation of the PHP code known as Zend opcodes
That means that the PHP code isn't parsed and executed directly, but compiled first, on the fly.
So yes, it is somehow compiled, but internally without the intervention of the user which makes it different than real compiled languages such as Java or C++.
That's my personal interpretation, feel free to comment if it's wrong.
The article you are mentioning is about a project called HipHop which is not classic PHP.
HipHop will take your php project (php files) and generate another set of files in C++ that will have the same behavior.
Once the project is a C++ project, it becomes a project that needs compilation.
HipHop was created by facebook engineers to improve the performance of their code (they use PHP a lot) without the need of rewriting their whole stack in another language.
To clarify the quote that PHP is a compiled language since PHP4, it is true that since PHP4 the scripts are not executed as they are parsed : Each included file is pre-"compiled" to opCode and it is this opcode that is dynamically executed.
This 2-stage process has enabled the creation of specific opCode caching tools that can greatly improve the execution time of PHP. cf for instance http://xcache.lighttpd.net/
The opCode is executed by a "virtual machine" that knows how to interpret these opCodes (a bit like the Java Virtual Machine).
HipHop leads to additional performance because this opCode layer is bypassed.
Related to this:
PHP became a compiled language in the year 2000, when PHP 4 was released for the first time. Until version 3, PHP source code was parsed and executed right away by the PHP interpreter.
this is correct too, but you have to look at the definitions of a "compiled" or "interpreted" to really grasp what this means. The distinction is really not that clear-cut. What is meant by compilers is commonly thought of as software transforming source code to executable form. However, more formal definition of a compiler is something transforming one form of representation into another form, like also mentioned in the article.
Interpreter is a piece of software that actually does the actions that are defined in the source code, instead of (just) transforming. Based on that definition, PHP is still (by default, excluding things like HipHop) interpreted. The change that was done on release of PHP4 was that the source code is not directly parsed and executed, but first compiled to an intermediary representation (in this case opcodes) in-memory by the interpreter, and then executed. That kind of "compilation" is what pretty much all modern interpreters of different languages do nowadays in some form or another.