3v4l.org

run code in 300+ PHP versions simultaneously
<?php $outer = function () { echo "Outer<br>"; $times = 0; $inner = function() use ($times){ echo "Inner : ${times}<br>"; if ( $times <= 2 ){ inner(); $times++; } }; return $inner; }; $inner = $outer(); var_dump( $inner ); $inner(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bstuR
function name:  (null)
number of ops:  11
compiled vars:  !0 = $outer, !1 = $inner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FbstuR%3A2%240'
          1        ASSIGN                                                   !0, ~2
   18     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   19     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
   20     8        INIT_DYNAMIC_CALL                                        !1
          9        DO_FCALL                                      0          
   21    10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FbstuR%3A2%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bstuR
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $times, !1 = $inner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     'Outer%3Cbr%3E'
    4     1        ASSIGN                                                   !0, 0
    6     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FbstuR%3A6%241'
          3        BIND_LEXICAL                                             ~3, !0
          4        ASSIGN                                                   !1, ~3
   15     5      > RETURN                                                   !1
   16     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FbstuR%3A2%240

Function %00%7Bclosure%7D%2Fin%2FbstuR%3A6%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/bstuR
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $times
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    7     1        ROPE_INIT                                     3  ~2      'Inner+%3A+'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%3Cbr%3E'
          4        ECHO                                                     ~1
    8     5        IS_SMALLER_OR_EQUAL                                      !0, 2
          6      > JMPZ                                                     ~4, ->10
    9     7    >   INIT_FCALL_BY_NAME                                       'inner'
          8        DO_FCALL                                      0          
   10     9        PRE_INC                                                  !0
   13    10    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FbstuR%3A6%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.2 ms | 1396 KiB | 15 Q