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', $this)})); } } 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/XLWSY
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/XLWSY
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/XLWSY
function name:  bar
number of ops:  18
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        FETCH_THIS                                       ~4      
         11        SEND_VAL                                                 ~4
         12        DO_FCALL                                      0  $5      
         13        FETCH_R                      local               ~6      $5
         14        GET_CLASS                                        ~7      ~6
         15        SEND_VAL                                                 ~7
         16        DO_ICALL                                                 
         17      > 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:
181.46 ms | 1398 KiB | 16 Q