3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_unique_array($array) { $result = array_map("unserialize", array_unique(array_map("serialize", $array))); foreach ($result as $key => $value) { if ( is_array($value) ) { $result[$key] = get_unique_array($value); } } return $result; } $array = array( array('id' => '123', 'dddd' => 'dd'), array('id' => '123', 'dddd' => 'dd'), array('id' => '111', 'dddd' => 'dd') ); $rr = super_unique($array); echo '<pre>'; print_r($rr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d31Bs
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array, !1 = $rr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   24     1        INIT_FCALL_BY_NAME                                       'super_unique'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   26     5        ECHO                                                     '%3Cpre%3E'
          6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function get_unique_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 24
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 24
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 23
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/d31Bs
function name:  get_unique_array
number of ops:  27
compiled vars:  !0 = $array, !1 = $result, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'array_map'
          2        SEND_VAL                                                 'unserialize'
          3        INIT_FCALL                                               'array_unique'
          4        INIT_FCALL                                               'array_map'
          5        SEND_VAL                                                 'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !1, $6
    6    13      > FE_RESET_R                                       $8      !1, ->24
         14    > > FE_FETCH_R                                       ~9      $8, !2, ->24
         15    >   ASSIGN                                                   !3, ~9
    8    16        TYPE_CHECK                                  128          !2
         17      > JMPZ                                                     ~11, ->23
   10    18    >   INIT_FCALL_BY_NAME                                       'get_unique_array'
         19        SEND_VAR_EX                                              !2
         20        DO_FCALL                                      0  $13     
         21        ASSIGN_DIM                                               !1, !3
         22        OP_DATA                                                  $13
    6    23    > > JMP                                                      ->14
         24    >   FE_FREE                                                  $8
   14    25      > RETURN                                                   !1
   15    26*     > RETURN                                                   null

End of function get_unique_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.49 ms | 1400 KiB | 19 Q