3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f_test(&$obj) { $obj->prop++; echo "prop=".$obj->prop." <br>\r\n"; } class clsTest { public $prop = 0; public $arg_array = false; function meth() { if ($this->arg_array===false) $this->arg_array = array(&$this); echo 'arg_array[0] '.(($this->arg_array[0]===$this) ? ' is the same instance' : ' is not the same instance').' than $this'." <br>\r\n"; call_user_func_array('f_test', $this->arg_array); } } $oTest = new clsTest; $oTest->meth(); // OK $oTest->meth(); // ERR ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PSGk9
function name:  (null)
number of ops:  8
compiled vars:  !0 = $oTest
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'clsTest'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_METHOD_CALL                                         !0, 'meth'
          4        DO_FCALL                                      0          
   20     5        INIT_METHOD_CALL                                         !0, 'meth'
          6        DO_FCALL                                      0          
   22     7      > RETURN                                                   1

Function f_test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PSGk9
function name:  f_test
number of ops:  7
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        PRE_INC_OBJ                                              !0, 'prop'
    5     2        FETCH_OBJ_R                                      ~2      !0, 'prop'
          3        CONCAT                                           ~3      'prop%3D', ~2
          4        CONCAT                                           ~4      ~3, '+%3Cbr%3E%0D%0A'
          5        ECHO                                                     ~4
    6     6      > RETURN                                                   null

End of function f_test

Class clsTest:
Function meth:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/PSGk9
function name:  meth
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                      ~0      'arg_array'
          1        TYPE_CHECK                                    4          ~0
          2      > JMPZ                                                     ~1, ->7
          3    >   FETCH_THIS                                       $3      
          4        INIT_ARRAY                                       ~4      $3
          5        ASSIGN_OBJ                                               'arg_array'
          6        OP_DATA                                                  ~4
   13     7    >   FETCH_OBJ_R                                      ~5      'arg_array'
          8        FETCH_DIM_R                                      ~6      ~5, 0
          9        FETCH_THIS                                       ~7      
         10        IS_IDENTICAL                                             ~6, ~7
         11      > JMPZ                                                     ~8, ->14
         12    >   QM_ASSIGN                                        ~9      '+is+the+same+instance'
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~9      '+is+not+the+same+instance'
         15    >   CONCAT                                           ~10     'arg_array%5B0%5D+', ~9
         16        CONCAT                                           ~11     ~10, '+than+%24this'
         17        CONCAT                                           ~12     ~11, '++%3Cbr%3E%0D%0A'
         18        ECHO                                                     ~12
   14    19        INIT_FCALL                                               'f_test'
         20        FETCH_OBJ_R                                      ~13     'arg_array'
         21        SEND_ARRAY                                               ~13
         22        CHECK_UNDEF_ARGS                                         
         23        DO_FCALL                                      0          
   15    24      > RETURN                                                   null

End of function meth

End of class clsTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.22 ms | 1407 KiB | 14 Q