3v4l.org

run code in 300+ 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 = 15
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
2 jumps found. (Code = 125) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
2 jumps found. (Code = 126) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 15
filename:       /in/Vk7hc
function name:  remove_dup_keys
number of ops:  28
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, ->15
          3    > > FE_FETCH_RW                                      ~5      $4, !2, ->15
          4    >   ASSIGN                                                   !3, ~5
   29     5        INIT_FCALL                                               'in_array'
          6        SEND_VAR                                                 !3
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $7      
          9      > JMPZ                                                     $7, ->12
   30    10    >   UNSET_DIM                                                !0, !3
   29    11      > JMP                                                      ->14
   33    12    >   ASSIGN_DIM                                               !1
         13        OP_DATA                                                  !3
   28    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $4
   36    16      > FE_RESET_RW                                      $9      !0, ->26
         17    > > FE_FETCH_RW                                      ~10     $9, !2, ->26
         18    >   ASSIGN                                                   !3, ~10
   37    19        TYPE_CHECK                                  128          !2
         20      > JMPZ                                                     ~12, ->25
   38    21    >   INIT_FCALL_BY_NAME                                       'remove_dup_keys'
         22        SEND_VAR_EX                                              !2
         23        SEND_VAR_EX                                              !1
         24        DO_FCALL                                      0          
   36    25    > > JMP                                                      ->17
         26    >   FE_FREE                                                  $9
   41    27      > RETURN                                                   null

End of function remove_dup_keys

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.98 ms | 1013 KiB | 16 Q