Internal Apparatus:
A Walk Through the Generated Code

By Edward Barnard

The PHP compiler/interpreter reads through our PHP code and produces an intermediate form. PHP’s virtual machine then interprets this intermediate form. PHP’s “generated code” feature allows us to walk through this intermediate form, better understanding exactly what PHP does with the software we write. We’ll begin with a three line example, observing the generated-code changes as we transform our example into a function call and then a static method call. We’ll implement a recursive algorithm to see how the code generator handles the situation.

This article was originally published in the July 2019 issue of php[architect] magazine. To read the complete article please subscribe or purchase the complete issue.

Related Articles

Leave a comment

Use the form below to leave a comment: