3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { function f() { $cl = function($p) {}; $rf = new ReflectionFunction($cl); $rps = $rf->getParams(); $rp = $rfs[0]; return $rp->getDeclaringFunction(); } } $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/0WgXR
function name:  (null)
number of ops:  19
compiled vars:  !0 = $c, !1 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $2      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   12     3        INIT_METHOD_CALL                                         !0, 'f'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   13     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !1, 'isClosure'
          8        DO_FCALL                                      0  $7      
          9        SEND_VAR                                                 $7
         10        DO_ICALL                                                 
   14    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%2F0WgXR%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0WgXR
function name:  {closure}
number of ops:  2
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

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

Class C:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0WgXR
function name:  f
number of ops:  15
compiled vars:  !0 = $cl, !1 = $rf, !2 = $rps, !3 = $rp, !4 = $rfs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0WgXR%3A4%240'
          1        ASSIGN                                                   !0, ~5
    5     2        NEW                                              $7      'ReflectionFunction'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $7
    6     6        INIT_METHOD_CALL                                         !1, 'getParams'
          7        DO_FCALL                                      0  $10     
          8        ASSIGN                                                   !2, $10
    7     9        FETCH_DIM_R                                      ~12     !4, 0
         10        ASSIGN                                                   !3, ~12
    8    11        INIT_METHOD_CALL                                         !3, 'getDeclaringFunction'
         12        DO_FCALL                                      0  $14     
         13      > RETURN                                                   $14
    9    14*     > RETURN                                                   null

End of function f

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.34 ms | 1392 KiB | 15 Q