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', isset($this) && false ?: get_defined_vars())} )); } } 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/1EQof
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/1EQof
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 = 46) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/1EQof
function name:  bar
number of ops:  24
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        ISSET_ISEMPTY_THIS                               ~4      
         11      > JMPZ_EX                                          ~4      ~4, ->13
         12    >   BOOL                                             ~4      <false>
         13    >   JMP_SET                                          ~5      ~4, ->17
         14        INIT_FCALL                                               'get_defined_vars'
         15        DO_ICALL                                         $6      
         16        QM_ASSIGN                                        ~5      $6
         17        SEND_VAL                                                 ~5
         18        DO_FCALL                                      0  $7      
         19        FETCH_R                      local               ~8      $7
         20        GET_CLASS                                        ~9      ~8
         21        SEND_VAL                                                 ~9
         22        DO_ICALL                                                 
    8    23      > 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:
156.21 ms | 1407 KiB | 18 Q