3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * call a closure inside an array returned by another closure * */ $arr["bleh"] = 0; $c = function(){ echo "a simple closure"; }; $foo = function() use ($arr,$c){ $arr["bar"] = $c; return $arr; }; $foo()["bar"]();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KDFLq
function name:  (null)
number of ops:  14
compiled vars:  !0 = $arr, !1 = $c, !2 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN_DIM                                               !0, 'bleh'
          1        OP_DATA                                                  0
    8     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKDFLq%3A8%240'
          3        ASSIGN                                                   !1, ~4
   12     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKDFLq%3A12%241'
          5        BIND_LEXICAL                                             ~6, !0
          6        BIND_LEXICAL                                             ~6, !1
          7        ASSIGN                                                   !2, ~6
   16     8        INIT_DYNAMIC_CALL                                        !2
          9        DO_FCALL                                      0  $8      
         10        FETCH_DIM_R                                      ~9      $8, 'bar'
         11        INIT_DYNAMIC_CALL                                        ~9
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FKDFLq%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KDFLq
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'a+simple+closure'
   10     1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKDFLq%3A8%240

Function %00%7Bclosure%7D%2Fin%2FKDFLq%3A12%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KDFLq
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $arr, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
   13     2        ASSIGN_DIM                                               !0, 'bar'
          3        OP_DATA                                                  !1
   14     4      > RETURN                                                   !0
   15     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKDFLq%3A12%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.28 ms | 1395 KiB | 13 Q