3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ('1' => (object)array( 'id' => 225, 'user_id' => 1, 'name' => 'Blue Quilted Leather Jacket by Minusey - $499' ), '2' => (object)array( 'id' => 222, 'user_id' => 1, 'name' => 'Darling New Bathtub by Duravit - $6300' ), '3' => (object)array( 'id' => 222, 'user_id' => 1, 'name' => 'Darling New Bathtub by Duravit - $6300' ) ); //print_r(array_column((array)$array, 'id')); $UniqueArray = array(); foreach($array as $key=>$value){ // rebuild your array //$id = $value['id']; //build array with unique key value $id = $value->id; //object $UniqueArray[$id] = $value; } print_r($UniqueArray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/FjRAI
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $UniqueArray, !2 = $value, !3 = $key, !4 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   CAST                                          8  ~5      <array>
          1        INIT_ARRAY                                       ~6      ~5, 1
   10     2        CAST                                          8  ~7      <array>
          3        ADD_ARRAY_ELEMENT                                ~6      ~7, 2
   16     4        CAST                                          8  ~8      <array>
          5        ADD_ARRAY_ELEMENT                                ~6      ~8, 3
    3     6        ASSIGN                                                   !0, ~6
   23     7        ASSIGN                                                   !1, <array>
   24     8      > FE_RESET_R                                       $11     !0, ->16
          9    > > FE_FETCH_R                                       ~12     $11, !2, ->16
         10    >   ASSIGN                                                   !3, ~12
   26    11        FETCH_OBJ_R                                      ~14     !2, 'id'
         12        ASSIGN                                                   !4, ~14
   27    13        ASSIGN_DIM                                               !1, !4
         14        OP_DATA                                                  !2
   24    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $11
   30    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.41 ms | 1399 KiB | 15 Q