3v4l.org

run code in 300+ PHP versions simultaneously
<?php function func(&$data) { foreach ($data as $key => $value) { if (is_array($value)) { func($data[$key]); } } } $data = [ ['k' => [0]], ['k' => [1]], ]; ob_start(); debug_zval_dump($data[1]['k']); echo explode("\n", ob_get_clean())[0]."\n"; // refcount(2) func($data); ob_start(); debug_zval_dump($data[1]['k']); echo explode("\n", ob_get_clean())[0]."\n"; // refcount(3) array_replace_recursive($data[0], $data[1]); echo json_encode($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1hoal
function name:  (null)
number of ops:  47
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'ob_start'
          2        DO_ICALL                                                 
          3        INIT_FCALL                                               'debug_zval_dump'
          4        FETCH_DIM_R                                      ~3      !0, 1
          5        FETCH_DIM_R                                      ~4      ~3, 'k'
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
          8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%0A'
         10        INIT_FCALL                                               'ob_get_clean'
         11        DO_ICALL                                         $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                         $7      
         14        FETCH_DIM_R                                      ~8      $7, 0
         15        CONCAT                                           ~9      ~8, '%0A'
         16        ECHO                                                     ~9
   16    17        INIT_FCALL                                               'func'
         18        SEND_REF                                                 !0
         19        DO_FCALL                                      0          
   17    20        INIT_FCALL                                               'ob_start'
         21        DO_ICALL                                                 
         22        INIT_FCALL                                               'debug_zval_dump'
         23        FETCH_DIM_R                                      ~12     !0, 1
         24        FETCH_DIM_R                                      ~13     ~12, 'k'
         25        SEND_VAL                                                 ~13
         26        DO_ICALL                                                 
         27        INIT_FCALL                                               'explode'
         28        SEND_VAL                                                 '%0A'
         29        INIT_FCALL                                               'ob_get_clean'
         30        DO_ICALL                                         $15     
         31        SEND_VAR                                                 $15
         32        DO_ICALL                                         $16     
         33        FETCH_DIM_R                                      ~17     $16, 0
         34        CONCAT                                           ~18     ~17, '%0A'
         35        ECHO                                                     ~18
   18    36        INIT_FCALL                                               'array_replace_recursive'
         37        FETCH_DIM_R                                      ~19     !0, 0
         38        SEND_VAL                                                 ~19
         39        FETCH_DIM_R                                      ~20     !0, 1
         40        SEND_VAL                                                 ~20
         41        DO_ICALL                                                 
   19    42        INIT_FCALL                                               'json_encode'
         43        SEND_VAR                                                 !0
         44        DO_ICALL                                         $22     
         45        ECHO                                                     $22
         46      > RETURN                                                   1

Function func:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 11
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/1hoal
function name:  func
number of ops:  14
compiled vars:  !0 = $data, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1      > FE_RESET_R                                       $3      !0, ->12
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->12
          3    >   ASSIGN                                                   !2, ~4
    4     4        TYPE_CHECK                                  128          !1
          5      > JMPZ                                                     ~6, ->11
    5     6    >   INIT_FCALL_BY_NAME                                       'func'
          7        CHECK_FUNC_ARG                                           
          8        FETCH_DIM_FUNC_ARG                               $7      !0, !2
          9        SEND_FUNC_ARG                                            $7
         10        DO_FCALL                                      0          
    3    11    > > JMP                                                      ->2
         12    >   FE_FREE                                                  $3
    8    13      > RETURN                                                   null

End of function func

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.29 ms | 1472 KiB | 20 Q