3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { function method($list=[]) { $list[] = 'Base::method'; return($list); } } trait MyTrait { function method($list=[]) { $list = parent::method($list); $list[] = 'MyTrait::method'; return($list); } } class Child extends Base { use MyTrait { MyTrait::method insteadof method; } function method($list=[]) { $list = parent::method($list); $list[] = 'Child::method'; return($list); } } $child = new Child(); echo(implode(' <= ', $child->method())."\n");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pWrDk
function name:  (null)
number of ops:  13
compiled vars:  !0 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   DECLARE_CLASS                                            'child', 'base'
   27     1        NEW                                              $1      'Child'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   28     4        INIT_FCALL                                               'implode'
          5        SEND_VAL                                                 '+%3C%3D+'
          6        INIT_METHOD_CALL                                         !0, 'method'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                         $5      
         10        CONCAT                                           ~6      $5, '%0A'
         11        ECHO                                                     ~6
         12      > RETURN                                                   1

Class Base:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pWrDk
function name:  method
number of ops:  5
compiled vars:  !0 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV_INIT                                        !0      <array>
    5     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  'Base%3A%3Amethod'
    6     3      > RETURN                                                   !0
    7     4*     > RETURN                                                   null

End of function method

End of class Base.

Class MyTrait:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pWrDk
function name:  method
number of ops:  9
compiled vars:  !0 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV_INIT                                        !0      <array>
   12     1        INIT_STATIC_METHOD_CALL                                  'method'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   13     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  'MyTrait%3A%3Amethod'
   14     7      > RETURN                                                   !0
   15     8*     > RETURN                                                   null

End of function method

End of class MyTrait.

Class Child:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pWrDk
function name:  method
number of ops:  9
compiled vars:  !0 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV_INIT                                        !0      <array>
   21     1        INIT_STATIC_METHOD_CALL                                  'method'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   22     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  'Child%3A%3Amethod'
   23     7      > RETURN                                                   !0
   24     8*     > RETURN                                                   null

End of function method

End of class Child.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.96 ms | 1400 KiB | 15 Q