3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr1 = Array ( "0" => Array ( "rut" => 333333333, "inscripcion_id" => 3940 ), "1" => Array ( "rut" => 444444444, "inscripcion_id" => 3941 ), "2" => Array ( "rut" => 333333333, "inscripcion_id" => 3985 ), "3" => Array ( "rut" => 555555555, "inscripcion_id" => 3987 ) ); $unique_array = array(); $unique_value = array_keys(array_count_values(array_column($arr1, "rut") ), 1, true); foreach ($arr1 as $key => $inner_arr) { if (in_array($inner_arr["rut"], $unique_value) ) { $unique_array[] = $arr1[$key]; unset($arr1[$key]); } } echo print_r($arr1, true); echo print_r($unique_array, true);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 26
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/JDou7
function name:  (null)
number of ops:  38
compiled vars:  !0 = $arr1, !1 = $unique_array, !2 = $unique_value, !3 = $inner_arr, !4 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   29     1        ASSIGN                                                       !1, <array>
   30     2        INIT_FCALL                                                   'array_keys'
          3        INIT_FCALL                                                   'array_count_values'
          4        INIT_FCALL                                                   'array_column'
          5        SEND_VAR                                                     !0
          6        SEND_VAL                                                     'rut'
          7        DO_ICALL                                             $7      
          8        SEND_VAR                                                     $7
          9        DO_ICALL                                             $8      
         10        SEND_VAR                                                     $8
         11        SEND_VAL                                                     1
         12        SEND_VAL                                                     <true>
         13        DO_ICALL                                             $9      
         14        ASSIGN                                                       !2, $9
   31    15      > FE_RESET_R                                           $11     !0, ->26
         16    > > FE_FETCH_R                                           ~12     $11, !3, ->26
         17    >   ASSIGN                                                       !4, ~12
   32    18        FETCH_DIM_R                                          ~14     !3, 'rut'
         19        FRAMELESS_ICALL_2                in_array            ~15     ~14, !2
         20      > JMPZ                                                         ~15, ->25
   33    21    >   FETCH_DIM_R                                          ~17     !0, !4
         22        ASSIGN_DIM                                                   !1
         23        OP_DATA                                                      ~17
   34    24        UNSET_DIM                                                    !0, !4
   31    25    > > JMP                                                          ->16
         26    >   FE_FREE                                                      $11
   37    27        INIT_FCALL                                                   'print_r'
         28        SEND_VAR                                                     !0
         29        SEND_VAL                                                     <true>
         30        DO_ICALL                                             $18     
         31        ECHO                                                         $18
   38    32        INIT_FCALL                                                   'print_r'
         33        SEND_VAR                                                     !1
         34        SEND_VAL                                                     <true>
         35        DO_ICALL                                             $19     
         36        ECHO                                                         $19
         37      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.65 ms | 2228 KiB | 18 Q