3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { function f() { return new ReflectionFunction(function() {}); } } $c = new C; $r = $c->f(); var_dump($r->isClosure()); var_dump($r->getClosureScopeClass()->getName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8M2aB
function name:  (null)
number of ops:  19
compiled vars:  !0 = $c, !1 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    8     3        INIT_METHOD_CALL                                         !0, 'f'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
    9     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !1, 'isClosure'
          8        DO_FCALL                                      0  $7      
          9        SEND_VAR                                                 $7
         10        DO_ICALL                                                 
   10    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !1, 'getClosureScopeClass'
         13        DO_FCALL                                      0  $9      
         14        INIT_METHOD_CALL                                         $9, 'getName'
         15        DO_FCALL                                      0  $10     
         16        SEND_VAR                                                 $10
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

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

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

Class C:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8M2aB
function name:  f
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   NEW                                              $0      'ReflectionFunction'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F8M2aB%3A4%240'
          2        SEND_VAL_EX                                              ~1
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $0
    5     5*     > RETURN                                                   null

End of function f

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.87 ms | 1396 KiB | 15 Q