3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = range(1, 10); $barr = $arr; $loop = function() use (& $loop, & $barr) { $v = array_shift($barr); if ($v) { var_dump($v); $loop(); } }; $loop();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Clo1A
function name:  (null)
number of ops:  13
compiled vars:  !0 = $arr, !1 = $barr, !2 = $loop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 10
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    4     5        ASSIGN                                                   !1, !0
    6     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FClo1A%3A6%240'
          7        BIND_LEXICAL                                             ~6, !2
          8        BIND_LEXICAL                                             ~6, !1
          9        ASSIGN                                                   !2, ~6
   16    10        INIT_DYNAMIC_CALL                                        !2
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FClo1A%3A6%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/Clo1A
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $loop, !1 = $barr, !2 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
    7     2        INIT_FCALL                                               'array_shift'
          3        SEND_REF                                                 !1
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
    9     6      > JMPZ                                                     !2, ->12
   10     7    >   INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
   12    10        INIT_DYNAMIC_CALL                                        !0
         11        DO_FCALL                                      0          
   14    12    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FClo1A%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.4 ms | 1396 KiB | 19 Q