3v4l.org

run code in 300+ PHP versions simultaneously
<?php function z($a) { $a[0]=1; //now we changed array, so PHP should make it's copy: debug_zval_dump($a); return $a; } $a = [ 'a', 'b', 'c' ]; debug_zval_dump($a); foreach(z($a) as &$x) { $x .= 'q'; } print_r($a);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 126) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/dldTB
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'debug_zval_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   14     4        INIT_FCALL                                               'z'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $4      
          7        SEPARATE                                         $4      $4
          8      > FE_RESET_RW                                      $5      $4, ->12
          9    > > FE_FETCH_RW                                              $5, !1, ->12
   15    10    >   ASSIGN_OP                                     8          !1, 'q'
   14    11      > JMP                                                      ->9
         12    >   FE_FREE                                                  $5
   17    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function z:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dldTB
function name:  z
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        ASSIGN_DIM                                               !0, 0
          2        OP_DATA                                                  1
    8     3        INIT_FCALL                                               'debug_zval_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
    9     6      > RETURN                                                   !0
   10     7*     > RETURN                                                   null

End of function z

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.43 ms | 1399 KiB | 18 Q