3v4l.org

run code in 500+ PHP versions simultaneously
<?php interface RequestInterface{} class Request implements RequestInterface {} interface Promise{} class PromiseImpl implements Promise {} interface Plugin { public function handleRequest(RequestInterface $request, callable $next, callable $first); } trait ForwardCompatibilityPlugin { abstract function doHandleRequest(RequestInterface $request, callable $next, callable $first); public function handleRequest(RequestInterface $request, callable $next, callable $first) { return $this->doHandleRequest($request, $next, $first); } } class MyPlugin implements Plugin { use ForwardCompatibilityPlugin; /** * {@inheritdoc} */ protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) { echo "foobar\n"; return $next($request); } } $request = new Request(); $callable = function() { echo "callable\n"; return new PromiseImpl(); }; $plugin = new MyPlugin(); $plugin->handleRequest($request, $callable, $callable);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ai0TG
function name:  (null)
number of ops:  17
compiled vars:  !0 = $request, !1 = $callable, !2 = $plugin
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                                'request'
    7     1        DECLARE_CLASS                                                'promiseimpl'
   25     2        DECLARE_CLASS                                                'myplugin'
   39     3        NEW                                                  $3      'Request'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !0, $3
   40     6        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
          7        ASSIGN                                                       !1, ~6
   46     8        NEW                                                  $8      'MyPlugin'
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !2, $8
   47    11        INIT_METHOD_CALL                                             !2, 'handleRequest'
         12        SEND_VAR_EX                                                  !0
         13        SEND_VAR_EX                                                  !1
         14        SEND_VAR_EX                                                  !1
         15        DO_FCALL                                          0          
         16      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ai0TG
function name:  {closure:/in/ai0TG:40}
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   41     0  E >   ECHO                                                         'callable%0A'
   43     1        NEW                                                  $0      'PromiseImpl'
          2        DO_FCALL                                          0          
          3      > RETURN                                                       $0
   44     4*     > RETURN                                                       null

End of Dynamic Function 0

Class RequestInterface: [no user functions]
Class Request: [no user functions]
Class Promise: [no user functions]
Class PromiseImpl: [no user functions]
Class Plugin:
Function handlerequest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ai0TG
function name:  handleRequest
number of ops:  4
compiled vars:  !0 = $request, !1 = $next, !2 = $first
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3      > RETURN                                                       null

End of function handlerequest

End of class Plugin.

Class ForwardCompatibilityPlugin:
Function dohandlerequest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ai0TG
function name:  doHandleRequest
number of ops:  4
compiled vars:  !0 = $request, !1 = $next, !2 = $first
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3      > RETURN                                                       null

End of function dohandlerequest

Function handlerequest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ai0TG
function name:  handleRequest
number of ops:  10
compiled vars:  !0 = $request, !1 = $next, !2 = $first
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
   21     3        INIT_METHOD_CALL                                             'doHandleRequest'
          4        SEND_VAR_EX                                                  !0
          5        SEND_VAR_EX                                                  !1
          6        SEND_VAR_EX                                                  !2
          7        DO_FCALL                                          0  $3      
          8      > RETURN                                                       $3
   22     9*     > RETURN                                                       null

End of function handlerequest

End of class ForwardCompatibilityPlugin.

Class MyPlugin:
Function dohandlerequest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ai0TG
function name:  doHandleRequest
number of ops:  9
compiled vars:  !0 = $request, !1 = $next, !2 = $first
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
   34     3        ECHO                                                         'foobar%0A'
   35     4        INIT_DYNAMIC_CALL                                            !1
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0  $3      
          7      > RETURN                                                       $3
   36     8*     > RETURN                                                       null

End of function dohandlerequest

End of class MyPlugin.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.21 ms | 1992 KiB | 13 Q