3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait ATrait { public function a(){ return 'Aa'; } } trait BTrait { public function a(){ return 'Ba'; } } class C { use ATrait{ a as aa; } use BTrait{ a as ba; } public function a() { return static::aa() . static::ba(); } } $o = new C; echo $o->a(), "\n"; class D { use ATrait{ ATrait::a as aa; } use BTrait{ BTrait::a as ba; } public function a() { return static::aa() . static::ba(); } } $o = new D; echo $o->a(), "\n"; class E { use ATrait{ ATrait::a as aa; ATrait::a insteadof BTrait; } use BTrait{ BTrait::a as ba; } public function e() { return static::aa() . static::ba(); } } $o = new E; echo $o->e(), "\n"; class F { use ATrait{ a as aa; } use BTrait{ a as ba; } public function f() { return static::aa() . static::ba(); } } $o = new F; echo $o->f(), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mFuQE
function name:  (null)
number of ops:  33
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'c'
   28     1        NEW                                              $1      'C'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   29     4        INIT_METHOD_CALL                                         !0, 'a'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7        ECHO                                                     '%0A'
   31     8        DECLARE_CLASS                                            'd'
   44     9        NEW                                              $5      'D'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !0, $5
   45    12        INIT_METHOD_CALL                                         !0, 'a'
         13        DO_FCALL                                      0  $8      
         14        ECHO                                                     $8
         15        ECHO                                                     '%0A'
   48    16        DECLARE_CLASS                                            'e'
   62    17        NEW                                              $9      'E'
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !0, $9
   63    20        INIT_METHOD_CALL                                         !0, 'e'
         21        DO_FCALL                                      0  $12     
         22        ECHO                                                     $12
         23        ECHO                                                     '%0A'
   65    24        DECLARE_CLASS                                            'f'
   78    25        NEW                                              $13     'F'
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !0, $13
   79    28        INIT_METHOD_CALL                                         !0, 'f'
         29        DO_FCALL                                      0  $16     
         30        ECHO                                                     $16
         31        ECHO                                                     '%0A'
         32      > RETURN                                                   1

Class ATrait:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mFuQE
function name:  a
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'Aa'
    6     1*     > RETURN                                                   null

End of function a

End of class ATrait.

Class BTrait:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mFuQE
function name:  a
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   'Ba'
   12     1*     > RETURN                                                   null

End of function a

End of class BTrait.

Class C:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mFuQE
function name:  a
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_STATIC_METHOD_CALL                                  'aa'
          1        DO_FCALL                                      0  $0      
          2        INIT_STATIC_METHOD_CALL                                  'ba'
          3        DO_FCALL                                      0  $1      
          4        CONCAT                                           ~2      $0, $1
          5      > RETURN                                                   ~2
   25     6*     > RETURN                                                   null

End of function a

End of class C.

Class D:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mFuQE
function name:  a
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   INIT_STATIC_METHOD_CALL                                  'aa'
          1        DO_FCALL                                      0  $0      
          2        INIT_STATIC_METHOD_CALL                                  'ba'
          3        DO_FCALL                                      0  $1      
          4        CONCAT                                           ~2      $0, $1
          5      > RETURN                                                   ~2
   41     6*     > RETURN                                                   null

End of function a

End of class D.

Class E:
Function e:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mFuQE
function name:  e
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E >   INIT_STATIC_METHOD_CALL                                  'aa'
          1        DO_FCALL                                      0  $0      
          2        INIT_STATIC_METHOD_CALL                                  'ba'
          3        DO_FCALL                                      0  $1      
          4        CONCAT                                           ~2      $0, $1
          5      > RETURN                                                   ~2
   59     6*     > RETURN                                                   null

End of function e

End of class E.

Class F:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mFuQE
function name:  f
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   74     0  E >   INIT_STATIC_METHOD_CALL                                  'aa'
          1        DO_FCALL                                      0  $0      
          2        INIT_STATIC_METHOD_CALL                                  'ba'
          3        DO_FCALL                                      0  $1      
          4        CONCAT                                           ~2      $0, $1
          5      > RETURN                                                   ~2
   75     6*     > RETURN                                                   null

End of function f

End of class F.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.58 ms | 1399 KiB | 13 Q