3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vars = array(); function assign ($var, $value) { global $vars; $vars[$var] = $value; } $a = new stdClass; $a->x = 3; assign('a', $a); $a->x = $a->x + 1; if ($vars['a']->x == $a->x) { print 'By reference'; } else { print 'By value'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FeOpJ
function name:  (null)
number of ops:  23
compiled vars:  !0 = $vars, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        NEW                                              $3      'stdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
    9     4        ASSIGN_OBJ                                               !1, 'x'
          5        OP_DATA                                                  3
   10     6        INIT_FCALL                                               'assign'
          7        SEND_VAL                                                 'a'
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0          
   11    10        FETCH_OBJ_R                                      ~9      !1, 'x'
         11        ADD                                              ~10     ~9, 1
         12        ASSIGN_OBJ                                               !1, 'x'
         13        OP_DATA                                                  ~10
   12    14        FETCH_DIM_R                                      ~11     !0, 'a'
         15        FETCH_OBJ_R                                      ~12     ~11, 'x'
         16        FETCH_OBJ_R                                      ~13     !1, 'x'
         17        IS_EQUAL                                                 ~12, ~13
         18      > JMPZ                                                     ~14, ->21
   13    19    >   ECHO                                                     'By+reference'
         20      > JMP                                                      ->22
   15    21    >   ECHO                                                     'By+value'
   16    22    > > RETURN                                                   1

Function assign:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FeOpJ
function name:  assign
number of ops:  6
compiled vars:  !0 = $var, !1 = $value, !2 = $vars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        BIND_GLOBAL                                              !2, 'vars'
    6     3        ASSIGN_DIM                                               !2, !0
          4        OP_DATA                                                  !1
    7     5      > RETURN                                                   null

End of function assign

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.42 ms | 1399 KiB | 14 Q