3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Example { public function sayHi () { echo "hi"; } } class Caller { private $_controller, $_action; public function __construct ($cont, $action) { $this->_controller = $cont; $this->_action = $action; } public function __toString() { return (string)$this->_action; } public function run () { $controller = new $this->_controller; if (is_callable(array($controller, $this->_action))) { $controller->{$this->_action}(); } } } $caller = new Caller ('Example', 'sayHi'); $caller->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2B0qg
function name:  (null)
number of ops:  9
compiled vars:  !0 = $caller
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'caller'
   29     1        NEW                                              $1      'Caller'
          2        SEND_VAL_EX                                              'Example'
          3        SEND_VAL_EX                                              'sayHi'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   30     6        INIT_METHOD_CALL                                         !0, 'run'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

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

End of function sayhi

End of class Example.

Class Caller:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2B0qg
function name:  __construct
number of ops:  7
compiled vars:  !0 = $cont, !1 = $action
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        ASSIGN_OBJ                                               '_controller'
          3        OP_DATA                                                  !0
   14     4        ASSIGN_OBJ                                               '_action'
          5        OP_DATA                                                  !1
   15     6      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2B0qg
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      '_action'
          1        CAST                                          6  ~1      ~0
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
   19     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __tostring

Function run:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/2B0qg
function name:  run
number of ops:  16
compiled vars:  !0 = $controller
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_OBJ_R                                      ~1      '_controller'
          1        FETCH_CLASS                                   0  $2      ~1
          2        NEW                                              $3      $2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   23     5        INIT_FCALL                                               'is_callable'
          6        INIT_ARRAY                                       ~6      !0
          7        FETCH_OBJ_R                                      ~7      '_action'
          8        ADD_ARRAY_ELEMENT                                ~6      ~7
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $8      
         11      > JMPZ                                                     $8, ->15
   24    12    >   FETCH_OBJ_R                                      ~9      '_action'
         13        INIT_METHOD_CALL                                         !0, ~9
         14        DO_FCALL                                      0          
   26    15    > > RETURN                                                   null

End of function run

End of class Caller.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.32 ms | 1456 KiB | 14 Q