Ver Mensaje Individual
  #3 (permalink)  
Antiguo 19/12/2012, 09:20
Avatar de Trublux
Trublux
 
Fecha de Ingreso: octubre-2010
Ubicación: Madrid
Mensajes: 355
Antigüedad: 13 años, 6 meses
Puntos: 48
Respuesta: Ordenar array multidimensional

La usé hace mucho y no lo recuerdo muy bien pero creo que esta función te servirá:
Código PHP:
Ver original
  1. static function orderMultiDimensionalArray( $toOrderArray, $field, $inverse = false )
  2. {
  3.     $position = array();
  4.     $newRow = array();
  5.     foreach ( $toOrderArray as $key => $row )
  6.     {
  7.         $position[$key] = $row[$field];
  8.         $newRow[$key] = $row;
  9.     }
  10.     if ( $inverse )
  11.         arsort( $position );
  12.     else
  13.         asort( $position );
  14.     $returnArray = array();
  15.     foreach ( $position as $key => $pos )
  16.         $returnArray[] = $newRow[$key];
  17.  
  18.     return $returnArray;
  19. }
__________________
eZ Publish Developer Basic Legacy
eZ Publish Developer Basics (4.4)
Alojamientos rurales en España