3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f ($name, $vars) { var_dump($vars); return $name; } trait A { function bar() { var_dump(get_class(), get_class(null), get_class(self), get_class(${f('this', array_merge(get_defined_vars(), array()))})); } } class B { use A; } $f = new B; $f->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/25QP5
function name:  (null)
number of ops:  7
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'b'
          1        NEW                                              $1      'B'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
          4        INIT_METHOD_CALL                                         !0, 'bar'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/25QP5
function name:  f
number of ops:  7
compiled vars:  !0 = $name, !1 = $vars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                                 
    4     5      > RETURN                                                   !0
    5     6*     > RETURN                                                   null

End of function f

Class A:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/25QP5
function name:  bar
number of ops:  23
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CLASS                                        ~0      
          2        SEND_VAL                                                 ~0
          3        GET_CLASS                                        ~1      null
          4        SEND_VAL                                                 ~1
          5        FETCH_CONSTANT                                   ~2      'self'
          6        GET_CLASS                                        ~3      ~2
          7        SEND_VAL                                                 ~3
          8        INIT_FCALL                                               'f'
          9        SEND_VAL                                                 'this'
         10        INIT_FCALL                                               'array_merge'
         11        INIT_FCALL                                               'get_defined_vars'
         12        DO_ICALL                                         $4      
         13        SEND_VAR                                                 $4
         14        SEND_VAL                                                 <array>
         15        DO_ICALL                                         $5      
         16        SEND_VAR                                                 $5
         17        DO_FCALL                                      0  $6      
         18        FETCH_R                      local               ~7      $6
         19        GET_CLASS                                        ~8      ~7
         20        SEND_VAL                                                 ~8
         21        DO_ICALL                                                 
         22      > RETURN                                                   null

End of function bar

End of class A.

Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.63 ms | 1394 KiB | 20 Q