3v4l.org

run code in 300+ 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 = 29
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 29
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 28
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/JDou7
function name:  (null)
number of ops:  41
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, ->29
         16    > > FE_FETCH_R                                       ~12     $11, !3, ->29
         17    >   ASSIGN                                                   !4, ~12
   32    18        INIT_FCALL                                               'in_array'
         19        FETCH_DIM_R                                      ~14     !3, 'rut'
         20        SEND_VAL                                                 ~14
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $15     
         23      > JMPZ                                                     $15, ->28
   33    24    >   FETCH_DIM_R                                      ~17     !0, !4
         25        ASSIGN_DIM                                               !1
         26        OP_DATA                                                  ~17
   34    27        UNSET_DIM                                                !0, !4
   31    28    > > JMP                                                      ->16
         29    >   FE_FREE                                                  $11
   37    30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $18     
         34        ECHO                                                     $18
   38    35        INIT_FCALL                                               'print_r'
         36        SEND_VAR                                                 !1
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                         $19     
         39        ECHO                                                     $19
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.34 ms | 1011 KiB | 18 Q