3v4l.org

run code in 300+ PHP versions simultaneously
<?php $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) { $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($f4);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wsvdh
function name:  (null)
number of ops:  8
compiled vars:  !0 = $zero, !1 = $f1, !2 = $f4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    3     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWsvdh%3A3%240'
          2        BIND_LEXICAL                                             ~4, !0
          3        ASSIGN                                                   !1, ~4
   16     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FWsvdh%3A3%240

Function %00%7Bclosure%7D%2Fin%2FWsvdh%3A5%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wsvdh
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
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
    6     2        ASSIGN                                                   !2, 2
    7     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWsvdh%3A7%242'
          4        BIND_LEXICAL                                             ~5, !0
          5        BIND_LEXICAL                                             ~5, !1
          6        BIND_LEXICAL                                             ~5, !2
          7        ASSIGN                                                   !3, ~5
   14     8      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FWsvdh%3A5%241

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

End of function %00%7Bclosure%7D%2Fin%2FWsvdh%3A7%242

Function %00%7Bclosure%7D%2Fin%2FWsvdh%3A9%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wsvdh
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
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   10     4        ASSIGN                                                   !4, 4
   11     5        ADD                                              ~6      !0, !1
          6        ADD                                              ~7      ~6, !2
          7        ADD                                              ~8      ~7, !3
          8        ADD                                              ~9      ~8, !4
          9        ECHO                                                     ~9
   12    10      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FWsvdh%3A9%243

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.52 ms | 1392 KiB | 15 Q