3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = array( "a" => "xxx", "b" => "xxx", "c" => array( "g" => "xxx", "a" => "xxx", "h" => "xxx", ), "d" => "xxx", "e" => array( "i" => array( "a" => "xxx", "k" => array( "l" => "xxx", "b" => "xxx", ), ), "j" => "xxx", ), "f" => "xxx", 'h' => array( 'p' => 'xxx', 'n' => 'xxx' ) ); function remove_dup_keys(&$array, &$keys = array()) { foreach ($array as $key => &$value) { if (in_array($key, $keys)) { unset($array[$key]); } else { $keys[] = $key; } } foreach ($array as $key => &$value) { if (is_array($value)) { remove_dup_keys($value, $keys); } } } remove_dup_keys($array); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vk7hc
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   43     1        INIT_FCALL                                                   'remove_dup_keys'
          2        SEND_REF                                                     !0
          3        DO_FCALL                                          0          
   44     4        INIT_FCALL                                                   'print_r'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

Function remove_dup_keys:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
2 jumps found. (Code = 125) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
2 jumps found. (Code = 126) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 12
filename:       /in/Vk7hc
function name:  remove_dup_keys
number of ops:  25
compiled vars:  !0 = $array, !1 = $keys, !2 = $value, !3 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      <array>
   28     2      > FE_RESET_RW                                          $4      !0, ->12
          3    > > FE_FETCH_RW                                          ~5      $4, !2, ->12
          4    >   ASSIGN                                                       !3, ~5
   29     5        FRAMELESS_ICALL_2                in_array            ~7      !3, !1
          6      > JMPZ                                                         ~7, ->9
   30     7    >   UNSET_DIM                                                    !0, !3
   29     8      > JMP                                                          ->11
   33     9    >   ASSIGN_DIM                                                   !1
         10        OP_DATA                                                      !3
   28    11    > > JMP                                                          ->3
         12    >   FE_FREE                                                      $4
   36    13      > FE_RESET_RW                                          $9      !0, ->23
         14    > > FE_FETCH_RW                                          ~10     $9, !2, ->23
         15    >   ASSIGN                                                       !3, ~10
   37    16        TYPE_CHECK                                      128          !2
         17      > JMPZ                                                         ~12, ->22
   38    18    >   INIT_FCALL_BY_NAME                                           'remove_dup_keys'
         19        SEND_VAR_EX                                                  !2
         20        SEND_VAR_EX                                                  !1
         21        DO_FCALL                                          0          
   36    22    > > JMP                                                          ->14
         23    >   FE_FREE                                                      $9
   41    24      > RETURN                                                       null

End of function remove_dup_keys

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.15 ms | 2100 KiB | 15 Q