Is PHP Compiled or Interpreted?

In this tutorial, we will learn whether PHP uses a compiler or is interpreted. By IncludeHelp Last updated : July 29, 2023

PHP uses both compilation and interpretation. Basically, PHP code is interpreted line by line but the code is compiled first to generate an intermediate bytecode. Then, this intermediate bytecode is interpreted by the runtime Zend engine.

What does PHP compiler do?

In the process of PHP compilation, the PHP compiler converts the given PHP code to generate an intermediate bytecode that can be used by the runtime engine. PHP compiler ignores the comments, resolves the variable names, class names, functions, etc., constructs the abstract syntax tree of your program, and creates a symbol table.

What does PHP interpreter do?

In the process of PHP compilation, the PHP interpreter interprets the generated intermediate bytecode line by line and executes it. PHP interpreter also handles runtime exceptions.



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.