3v4l.org

run code in 300+ 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); } abstract class ForwardCompatibilityPlugin implements Plugin { 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 extends ForwardCompatibilityPlugin { /** * {@inheritdoc} */ public 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/pn47M
function name:  (null)
number of ops:  18
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'
   14     2        DECLARE_CLASS                                            'forwardcompatibilityplugin'
   25     3        DECLARE_CLASS                                            'myplugin', 'forwardcompatibilityplugin'
   37     4        NEW                                              $3      'Request'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $3
   38     7        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          8        ASSIGN                                                   !1, ~6
   44     9        NEW                                              $8      'MyPlugin'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $8
   45    12        INIT_METHOD_CALL                                         !2, 'handleRequest'
         13        SEND_VAR_EX                                              !0
         14        SEND_VAR_EX                                              !1
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
         17      > 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/pn47M
function name:  {closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   ECHO                                                     'callable%0A'
   41     1        NEW                                              $0      'PromiseImpl'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   $0
   42     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/pn47M
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/pn47M
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/pn47M
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/pn47M
function name:  doHandleRequest
number of ops:  9
compiled vars:  !0 = $request, !1 = $next, !2 = $first
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   32     3        ECHO                                                     'foobar%0A'
   33     4        INIT_DYNAMIC_CALL                                        !1
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   34     8*     > RETURN                                                   null

End of function dohandlerequest

End of class MyPlugin.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.48 ms | 1012 KiB | 13 Q