3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Behaviors { public function __get($p) { if (method_exists($this, '__netteObjectFoo')) { $this->__netteObjectFoo($p); } if (method_exists($this, '__netteObjectBar')) { $this->__netteObjectBar($p); } } } trait Foo { public function __netteObjectFoo($p) { echo "foo"; } } trait Bar { public function __netteObjectBar($p) { echo "bar"; } } class A { use Behaviors, Foo; } class B { use Behaviors, Bar; } class C { use Behaviors, Foo, Bar; } (new A())->x; echo PHP_EOL; (new B())->x; echo PHP_EOL; (new C())->x; echo PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h977k
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   DECLARE_CLASS                                            'a'
   27     1        DECLARE_CLASS                                            'b'
   28     2        DECLARE_CLASS                                            'c'
   30     3        NEW                                              $0      'A'
          4        DO_FCALL                                      0          
          5        FETCH_OBJ_R                                      ~2      $0, 'x'
          6        FREE                                                     ~2
   31     7        ECHO                                                     '%0A'
   32     8        NEW                                              $3      'B'
          9        DO_FCALL                                      0          
         10        FETCH_OBJ_R                                      ~5      $3, 'x'
         11        FREE                                                     ~5
   33    12        ECHO                                                     '%0A'
   34    13        NEW                                              $6      'C'
         14        DO_FCALL                                      0          
         15        FETCH_OBJ_R                                      ~8      $6, 'x'
         16        FREE                                                     ~8
   35    17        ECHO                                                     '%0A'
         18      > RETURN                                                   1

Class Behaviors:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 10
filename:       /in/h977k
function name:  __get
number of ops:  20
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'method_exists'
          2        FETCH_THIS                                       ~1      
          3        SEND_VAL                                                 ~1
          4        SEND_VAL                                                 '__netteObjectFoo'
          5        DO_ICALL                                         $2      
          6      > JMPZ                                                     $2, ->10
    8     7    >   INIT_METHOD_CALL                                         '__netteObjectFoo'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   10    10    >   INIT_FCALL                                               'method_exists'
         11        FETCH_THIS                                       ~4      
         12        SEND_VAL                                                 ~4
         13        SEND_VAL                                                 '__netteObjectBar'
         14        DO_ICALL                                         $5      
         15      > JMPZ                                                     $5, ->19
   11    16    >   INIT_METHOD_CALL                                         '__netteObjectBar'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
   13    19    > > RETURN                                                   null

End of function __get

End of class Behaviors.

Class Foo:
Function __netteobjectfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h977k
function name:  __netteObjectFoo
number of ops:  3
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        ECHO                                                     'foo'
          2      > RETURN                                                   null

End of function __netteobjectfoo

End of class Foo.

Class Bar:
Function __netteobjectbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h977k
function name:  __netteObjectBar
number of ops:  3
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        ECHO                                                     'bar'
          2      > RETURN                                                   null

End of function __netteobjectbar

End of class Bar.

Class A: [no user functions]
Class B: [no user functions]
Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.32 ms | 1400 KiB | 15 Q