3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Mod { private $opmode; public function init($params) { $this->opmode = &$params['opmode']; } public function setup() { $this->opmode = 'dog'; } public function print() { echo $this->opmode . "\n"; } } $reference = 'fish'; $obj = new Mod(); $obj->init(['opmode' => &$reference]); $obj->print(); // fish $obj->setup(); $obj->print(); // dog $reference = 'cats'; $obj->print(); // cats
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T9qr2
function name:  (null)
number of ops:  18
compiled vars:  !0 = $reference, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ASSIGN                                                   !0, 'fish'
   23     1        NEW                                              $3      'Mod'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   25     4        INIT_METHOD_CALL                                         !1, 'init'
          5        INIT_ARRAY                                       ~6      !0, 'opmode'
          6        SEND_VAL_EX                                              ~6
          7        DO_FCALL                                      0          
   26     8        INIT_METHOD_CALL                                         !1, 'print'
          9        DO_FCALL                                      0          
   28    10        INIT_METHOD_CALL                                         !1, 'setup'
         11        DO_FCALL                                      0          
   29    12        INIT_METHOD_CALL                                         !1, 'print'
         13        DO_FCALL                                      0          
   31    14        ASSIGN                                                   !0, 'cats'
   32    15        INIT_METHOD_CALL                                         !1, 'print'
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Class Mod:
Function init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T9qr2
function name:  init
number of ops:  6
compiled vars:  !0 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        FETCH_DIM_W                                      $2      !0, 'opmode'
          2        MAKE_REF                                         $3      $2
          3        ASSIGN_OBJ_REF                                           'opmode'
          4        OP_DATA                                                  $3
    8     5      > RETURN                                                   null

End of function init

Function setup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T9qr2
function name:  setup
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN_OBJ                                               'opmode'
          1        OP_DATA                                                  'dog'
   13     2      > RETURN                                                   null

End of function setup

Function print:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T9qr2
function name:  print
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'opmode'
          1        CONCAT                                           ~1      ~0, '%0A'
          2        ECHO                                                     ~1
   18     3      > RETURN                                                   null

End of function print

End of class Mod.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.9 ms | 1399 KiB | 13 Q