Revision: 939
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 22, 2006 08:52 by olive
Initial Code
$data[] = array('volume' => 67, 'edition' => 2);
$data[] = array('volume' => 86, 'edition' => 1);
$data[] = array('volume' => 85, 'edition' => 6);
$data[] = array('volume' => 98, 'edition' => 2);
$data[] = array('volume' => 86, 'edition' => 6);
$data[] = array('volume' => 67, 'edition' => 7);
echo "<pre>";print_r($data);echo "</pre><br/>--------------------</br/>";
// Obtient une liste de colonnes
foreach ($data as $key => $row) {
$volume[$key] = $row['volume'];
$edition[$key] = $row['edition'];
}
// Tri les données par volume décroissant, edition croissant
// Ajoute $data en tant que premier paramètre, pour trier par la clé commune
array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data);
echo "<pre>";print_r($data);echo "</pre><br/>--------------------</br/>";
Initial URL
http://www.nexen.net/docs/php/annotee/function.array-multisort.php?lien=order
Initial Description
Initial Title
Tri tableau multidimensionnel
Initial Tags
Initial Language
PHP