3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait EndpointInjector { public function before($str) { echo $str; } } class Endpoint { use EndpointInjector; public function test($boringObj) { return $boringObj->withBody('#'); } } class BoringObj { public function withBody($str) { return $str; } } $ep = new Endpoint(); $ep->before(); $ep->test(new BoringObj());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/93pHc
function name:  (null)
number of ops:  12
compiled vars:  !0 = $ep
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'endpoint'
   29     1        NEW                                              $1      'Endpoint'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   30     4        INIT_METHOD_CALL                                         !0, 'before'
          5        DO_FCALL                                      0          
   31     6        INIT_METHOD_CALL                                         !0, 'test'
          7        NEW                                              $5      'BoringObj'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $5
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class EndpointInjector:
Function before:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/93pHc
function name:  before
number of ops:  3
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ECHO                                                     !0
    8     2      > RETURN                                                   null

End of function before

End of class EndpointInjector.

Class Endpoint:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/93pHc
function name:  test
number of ops:  6
compiled vars:  !0 = $boringObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        INIT_METHOD_CALL                                         !0, 'withBody'
          2        SEND_VAL_EX                                              '%23'
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   18     5*     > RETURN                                                   null

End of function test

End of class Endpoint.

Class BoringObj:
Function withbody:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/93pHc
function name:  withBody
number of ops:  3
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   25     1      > RETURN                                                   !0
   26     2*     > RETURN                                                   null

End of function withbody

End of class BoringObj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.85 ms | 1395 KiB | 13 Q