Where to Begin
Briefly

Where to Begin
"Strictly speaking, PHP is... an interpreter with compiler-like qualities. the nature of PHP (or Javascript, for that matter) is more of an... interpreter with multiple passes. Javascript does execute line by line.... but it also knows about functions within the entire scope of the current line's execution, even before encountering the function declaration in the code in its pass. So... it's parsed the file, one might call that compiled it, and then executes it line by line."
"PHP takes the source code and compiles it into what is known as a bytecode. This bytecode is then interpreted by the PHP engine. Relatively recently, PHP also added JIT support that takes things a step further and compiles some of that bytecode into machine code, which can improve speed when code is run repeatedly (like the contents of a loop). Generally this compile and interpret cycle is performed every time the script is run. In some circumstances one can setup Opcache which allows PHP to save the compilation result and skip it on future runs of the script, improving performance."
PHP functions as an interpreter with compiler-like behavior and can perform multiple parsing/execution passes. JavaScript executes sequentially while pre-parsing the file so functions are available before their declarations. Node.js and similar platforms add JIT compilation, blending interpretation and compilation. PHP compiles source into bytecode that the engine interprets; newer PHP versions offer JIT that converts bytecode to machine code for repeatedly executed code paths. Opcache can persist compiled results to avoid recompilation. Historical distinctions that compilers produce standalone executables have faded as implementations mix translation and interpretation techniques.
[
|
]