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(), isset($this) ? array() : 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/5u450
function name:  (null)
number of ops:  7
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     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/5u450
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
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5u450
function name:  bar
number of ops:  28
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
    7     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        ISSET_ISEMPTY_THIS                               ~5      
         15      > JMPZ                                                     ~5, ->18
         16    >   QM_ASSIGN                                        ~6      <array>
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~6      <array>
         19    >   SEND_VAL                                                 ~6
         20        DO_ICALL                                         $7      
         21        SEND_VAR                                                 $7
         22        DO_FCALL                                      0  $8      
         23        FETCH_R                      local               ~9      $8
         24        GET_CLASS                                        ~10     ~9
         25        SEND_VAL                                                 ~10
         26        DO_ICALL                                                 
    8    27      > 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:
158.97 ms | 1403 KiB | 20 Q