3v4l.org

run code in 300+ PHP versions simultaneously
<?php $f4 = null; $zero = 0; // global scope $f1 = function() use ($zero) { $one = 1; // third-level closure scope of f4 $f2 = function() use ($zero, $one) { $two = 2; // second-level closure scope of f4 $f3 = function() use ($zero, $one, $two) { global $f4; $three = 3; // first-level closure scope of f4 $f4 = function() use ($zero, $one, $two, $three) { $four = 4; // local scope of f4 echo $zero + $one + $two + $three + $four; }; }; }; }; var_dump($f1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5C6fJ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $f4, !1 = $zero, !2 = $f1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, null
    3     1        ASSIGN                                                   !1, 0
    4     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5C6fJ%3A4%240'
          3        BIND_LEXICAL                                             ~5, !1
          4        ASSIGN                                                   !2, ~5
   18     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F5C6fJ%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5C6fJ
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $zero, !1 = $one, !2 = $f2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   BIND_STATIC                                              !0
    5     1        ASSIGN                                                   !1, 1
    6     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5C6fJ%3A6%241'
          3        BIND_LEXICAL                                             ~4, !0
          4        BIND_LEXICAL                                             ~4, !1
          5        ASSIGN                                                   !2, ~4
   17     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5C6fJ%3A4%240

Function %00%7Bclosure%7D%2Fin%2F5C6fJ%3A6%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5C6fJ
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $zero, !1 = $one, !2 = $two, !3 = $f3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
    7     2        ASSIGN                                                   !2, 2
    8     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5C6fJ%3A8%242'
          4        BIND_LEXICAL                                             ~5, !0
          5        BIND_LEXICAL                                             ~5, !1
          6        BIND_LEXICAL                                             ~5, !2
          7        ASSIGN                                                   !3, ~5
   16     8      > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2F5C6fJ%3A8%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5C6fJ
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $zero, !1 = $one, !2 = $two, !3 = $f4, !4 = $three
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    9     3        BIND_GLOBAL                                              !3, 'f4'
   10     4        ASSIGN                                                   !4, 3
   11     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5C6fJ%3A11%243'
          6        BIND_LEXICAL                                             ~6, !0
          7        BIND_LEXICAL                                             ~6, !1
          8        BIND_LEXICAL                                             ~6, !2
          9        BIND_LEXICAL                                             ~6, !4
         10        ASSIGN                                                   !3, ~6
   15    11      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5C6fJ%3A8%242

Function %00%7Bclosure%7D%2Fin%2F5C6fJ%3A11%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5C6fJ
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $zero, !1 = $one, !2 = $two, !3 = $three, !4 = $four
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   12     4        ASSIGN                                                   !4, 4
   13     5        ADD                                              ~6      !0, !1
          6        ADD                                              ~7      ~6, !2
          7        ADD                                              ~8      ~7, !3
          8        ADD                                              ~9      ~8, !4
          9        ECHO                                                     ~9
   14    10      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5C6fJ%3A11%243

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.88 ms | 1400 KiB | 15 Q