php先被Zend引擎编译为opcode,那么opcode又是如何被zend_execute执行的呢?最终是被编译为机器码了吗?具体过程是如何的?
<code class="language-c"><span class="k">while</span> <span class="p">(</span><span class="n">TRUE</span><span class="p">)</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">opcode</span> <span class="o">=</span> <span class="o">*</span><span class="n">program_counter</span><span class="p">;</span> <span class="k">switch</span> <span class="p">(</span><span class="n">opcode</span><span class="p">)</span> <span class="p">{</span> <span class="k">case</span> <span class="nl">ZEND_ADD</span><span class="p">:</span> <span class="c1">// execute add ...</span> <span class="n">program_counter</span><span class="o">++</span><span class="p">;</span> <span class="c1">// next opcode</span> <span class="k">break</span><span class="p">;</span> <span class="k">case</span> <span class="nl">ZEND_SUB</span><span class="p">:</span> <span class="c1">// execute sub ...</span> <span class="n">program_counter</span><span class="o">++</span><span class="p">;</span> <span class="c1">// next opcode</span> <span class="k">break</span><span class="p">;</span> <span class="c1">// ...</span> <span class="p">}</span> <span class="p">}</span> </code>