3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { return $this; } $closure = (new ReflectionFunction(function () { return $this; }))->getClosure()->bindTo(new stdClass(), null); var_dump($closure);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WN5NP
function name:  (null)
number of ops:  17
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $1      'ReflectionFunction'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWN5NP%3A7%240'
          2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $1, 'getClosure'
          5        DO_FCALL                                      0  $4      
          6        INIT_METHOD_CALL                                         $4, 'bindTo'
          7        NEW                                              $5      'stdClass'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $5
         10        SEND_VAL_EX                                              null
         11        DO_FCALL                                      0  $7      
         12        ASSIGN                                                   !0, $7
    8    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WN5NP
function name:  foo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_THIS                                       ~0      
          1      > RETURN                                                   ~0
    5     2*     > RETURN                                                   null

End of function foo

Function %00%7Bclosure%7D%2Fin%2FWN5NP%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WN5NP
function name:  {closure}
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       ~0      
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FWN5NP%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.18 ms | 1396 KiB | 15 Q