3v4l.org

run code in 300+ PHP versions simultaneously
<?php $map = ['cart' => ['items' => ['product' => []]]]; $result = [ 'cart' => ['a' => 10, 'b' => 20], 'items' => ['c' => 3], 'product' => ['e' => 66], ]; $mapRes = $map; function get(&$map, $result, &$mapRes) { $val = &$map; foreach ($val as $key => &$m) { var_dump( array_walk_recursive($m, 'test_print')); if (!empty($m)) { get($m, $result,$mapRes); } //var_dump($m); // $val[$key] = $result[$key]; //var_dump($m); } } // get($map, $result, $mapRes); // var_dump($map); function test_print(&$item, $key) { echo "La clé $key contient l'élément $item\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xctrc
function name:  (null)
number of ops:  4
compiled vars:  !0 = $map, !1 = $result, !2 = $mapRes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    8     2        ASSIGN                                                   !2, !0
   30     3      > RETURN                                                   1

Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 5, Position 2 = 23
Branch analysis from position: 5
2 jumps found. (Code = 126) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/Xctrc
function name:  get
number of ops:  25
compiled vars:  !0 = $map, !1 = $result, !2 = $mapRes, !3 = $val, !4 = $m, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   12     3        ASSIGN_REF                                               !3, !0
   13     4      > FE_RESET_RW                                      $7      !3, ->23
          5    > > FE_FETCH_RW                                      ~8      $7, !4, ->23
          6    >   ASSIGN                                                   !5, ~8
   14     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'array_walk_recursive'
          9        SEND_REF                                                 !4
         10        SEND_VAL                                                 'test_print'
         11        DO_ICALL                                         $10     
         12        SEND_VAR                                                 $10
         13        DO_ICALL                                                 
   15    14        ISSET_ISEMPTY_CV                                 ~12     !4
         15        BOOL_NOT                                         ~13     ~12
         16      > JMPZ                                                     ~13, ->22
   16    17    >   INIT_FCALL_BY_NAME                                       'get'
         18        SEND_VAR_EX                                              !4
         19        SEND_VAR_EX                                              !1
         20        SEND_VAR_EX                                              !2
         21        DO_FCALL                                      0          
   13    22    > > JMP                                                      ->5
         23    >   FE_FREE                                                  $7
   22    24      > RETURN                                                   null

End of function get

Function test_print:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xctrc
function name:  test_print
number of ops:  9
compiled vars:  !0 = $item, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   29     2        ROPE_INIT                                     5  ~3      'La+cl%C3%A9+'
          3        ROPE_ADD                                      1  ~3      ~3, !1
          4        ROPE_ADD                                      2  ~3      ~3, '+contient+l%27%C3%A9l%C3%A9ment+'
          5        ROPE_ADD                                      3  ~3      ~3, !0
          6        ROPE_END                                      4  ~2      ~3, '%0A'
          7        ECHO                                                     ~2
   30     8      > RETURN                                                   null

End of function test_print

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.39 ms | 1400 KiB | 17 Q