Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/11/2014, 21:51
Avatar de pateketrueke
pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años, 11 meses
Puntos: 2534
Respuesta: Mostrar array único

Para poder usar array_unique() primero debes agrupar los elementos en común, así:

Código PHP:
Ver original
  1. $list = [
  2.   ['x' => 'a', 'y' => 1],
  3.   ['x' => 'b', 'y' => 2],
  4.   ['x' => 'a', 'y' => 3],
  5. ];
  6.  
  7. $groups = [];
  8.  
  9. foreach ($list as $object) {
  10.   foreach ($object as $key => $value) {
  11.     if (!isset($groups[$key])) {
  12.       $groups[$key] = [];
  13.     }
  14.  
  15.     $groups[$key] []= $value;
  16.   }
  17. }
  18.  
  19. foreach ($groups as $key => $group) {
  20.   echo $key, ' = ', join(', ', array_unique($group)), "\n";
  21. }
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.