3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ConfiguratorDelegate { public function didSelectOption($option); } class ViewController implements ConfiguratorDelegate { public function didSelectOption($option) { echo "Selected option"; } public function __construct() { $configurator = new Configurator(); $configurator->delegate = $this; } } class Configurator { public $delegate; // This would be defined as an object that always implements ConfiguratorDelegate private function optionSelected($option) { if ($delegate) { $delegate->didSelectOption($option); } } } $myVC = new ViewController();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Kg2C
function name:  (null)
number of ops:  5
compiled vars:  !0 = $myVC
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'viewcontroller'
   31     1        NEW                                              $1      'ViewController'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
          4      > RETURN                                                   1

Class ConfiguratorDelegate:
Function didselectoption:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Kg2C
function name:  didSelectOption
number of ops:  2
compiled vars:  !0 = $option
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function didselectoption

End of class ConfiguratorDelegate.

Class ViewController:
Function didselectoption:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Kg2C
function name:  didSelectOption
number of ops:  3
compiled vars:  !0 = $option
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ECHO                                                     'Selected+option'
   12     2      > RETURN                                                   null

End of function didselectoption

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Kg2C
function name:  __construct
number of ops:  7
compiled vars:  !0 = $configurator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'Configurator'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   16     3        FETCH_THIS                                       ~5      
          4        ASSIGN_OBJ                                               !0, 'delegate'
          5        OP_DATA                                                  ~5
   17     6      > RETURN                                                   null

End of function __construct

End of class ViewController.

Class Configurator:
Function optionselected:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/9Kg2C
function name:  optionSelected
number of ops:  6
compiled vars:  !0 = $option, !1 = $delegate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1      > JMPZ                                                     !1, ->5
   25     2    >   INIT_METHOD_CALL                                         !1, 'didSelectOption'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   27     5    > > RETURN                                                   null

End of function optionselected

End of class Configurator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.88 ms | 1399 KiB | 13 Q