3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "one" => "one", "two" => "two", "group1" => [ "three" => "three", "four" => "four", "group2" => [ "five" => "five", ], ], "group3" => [ "six" => "six", ] ]; function mergeRecursive(array $array, $result = []) { foreach($array as $k => $v) { if(!is_array($array)) $result[] = $v; else $result[] = $k . mergeRecursive($v); } return $result; } $result = mergeRecursive($array); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZW9IO
function name:  (null)
number of ops:  9
compiled vars:  !0 = $arr, !1 = $result, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   35     1        INIT_FCALL                                               'mergerecursive'
          2        SEND_VAR                                                 !2
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   36     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function mergerecursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/ZW9IO
function name:  mergeRecursive
number of ops:  21
compiled vars:  !0 = $array, !1 = $result, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
   23     2      > FE_RESET_R                                       $4      !0, ->18
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->18
          4    >   ASSIGN                                                   !3, ~5
   24     5        TYPE_CHECK                                  128  ~7      !0
          6        BOOL_NOT                                         ~8      ~7
          7      > JMPZ                                                     ~8, ->11
   25     8    >   ASSIGN_DIM                                               !1
          9        OP_DATA                                                  !2
         10      > JMP                                                      ->17
   27    11    >   INIT_FCALL_BY_NAME                                       'mergeRecursive'
         12        SEND_VAR_EX                                              !2
         13        DO_FCALL                                      0  $11     
         14        CONCAT                                           ~12     !3, $11
         15        ASSIGN_DIM                                               !1
         16        OP_DATA                                                  ~12
   23    17    > > JMP                                                      ->3
         18    >   FE_FREE                                                  $4
   30    19      > RETURN                                                   !1
   32    20*     > RETURN                                                   null

End of function mergerecursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.75 ms | 1399 KiB | 16 Q