3v4l.org

run code in 300+ PHP versions simultaneously
<?php $outer = function ( $n ) { echo "Outer\n"; $times = 0; $inner = function () use ( &$times, &$inner, $n ) { echo "Inner : ${times}\n"; $times++; if ( $times < $n ){ $inner(); } }; return $inner; }; $inner = $outer(4); $inner(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bJcJR
function name:  (null)
number of ops:  9
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%2FbJcJR%3A2%240'
          1        ASSIGN                                                   !0, ~2
   18     2        INIT_DYNAMIC_CALL                                        !0
          3        SEND_VAL_EX                                              4
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   19     6        INIT_DYNAMIC_CALL                                        !1
          7        DO_FCALL                                      0          
   20     8      > RETURN                                                   1

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

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

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.76 ms | 1399 KiB | 13 Q