3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 1, 2, 3, 4, 5, 6 ]; $var = function() use ($arr) { yield $arr[0]; }; echo $var();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ACQ1B
function name:  (null)
number of ops:  8
compiled vars:  !0 = $arr, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FACQ1B%3A7%240'
          2        BIND_LEXICAL                                             ~3, !0
          3        ASSIGN                                                   !1, ~3
   10     4        INIT_DYNAMIC_CALL                                        !1
          5        DO_FCALL                                      0  $5      
          6        ECHO                                                     $5
          7      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FACQ1B%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/ACQ1B
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   GENERATOR_CREATE                                         
          1        BIND_STATIC                                              !0
    8     2        FETCH_DIM_R                                      ~1      !0, 0
          3        YIELD                                                    ~1
    9     4      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FACQ1B%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.62 ms | 1393 KiB | 13 Q