3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &testfunction() { global $testglobal; return ($testglobal=1); } $testglobal_link=&call_user_func_array("testfuncti on",array('testparam-1','testparam-2')); // $testglobal_link must be link to $testglobal at this stage print $testglobal_link; // trying to assign new value to $testglobal thru link $testglobal_link=2; // in theory we will get "2" as result print $testglobal; // but unfortunatly we will have "1" as result print $testglobal_link;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LS0jv
function name:  (null)
number of ops:  10
compiled vars:  !0 = $testglobal_link, !1 = $testglobal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_USER_CALL                                0          'call_user_func_array', 'testfuncti+on'
          1        SEND_ARRAY                                               <array>
          2        CHECK_UNDEF_ARGS                                         
          3        DO_FCALL                                      0  $2      
          4        ASSIGN_REF                                               !0, $2
   12     5        ECHO                                                     !0
   14     6        ASSIGN                                                   !0, 2
   16     7        ECHO                                                     !1
   18     8        ECHO                                                     !0
          9      > RETURN                                                   1

Function testfunction:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/LS0jv
function name:  testfunction
number of ops:  4
compiled vars:  !0 = $testglobal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_GLOBAL                                              !0, 'testglobal'
    7     1        ASSIGN                                           ~1      !0, 1
          2      > RETURN_BY_REF                                            ~1
    8     3*     > RETURN_BY_REF                                            null

End of function testfunction

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.31 ms | 1393 KiB | 13 Q