Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/02/2011, 18:29
Avatar de DeeR
DeeR
 
Fecha de Ingreso: diciembre-2003
Ubicación: Santiago
Mensajes: 520
Antigüedad: 20 años, 4 meses
Puntos: 17
Respuesta: Ordenando alfabeticamente una lista.

Puedes implementar algún algoritmo de ordenación como el Quick Sort, Bubble Sort, etc o utilizar la función sort o ksort.

Te dejo un pequeño ejemplo ordenando un arreglo por sus llaves con ksort
Código PHP:
<?php

$mylist
["Deerme.org"] = "http://deerme.org";
$mylist["Air"] = "http://www.google.cl";
$mylist["Ah! My Goddess"] = "http://www.google.cl";
$mylist["Aishiteru ze Baby"] = "http://www.google.cl";
$mylist["Akira"] = "http://www.google.cl";
$mylist["BBCode"] = "http://www.google.cl";
$mylist["Astro Boy<"] = "http://www.google.cl";

ksort($mylist);
echo 
"<ul>\n";
foreach( 
$mylist as $name => $link )
{
    echo 
"\t<li><a href='".$link."'>".$name."</a></li>\n";
}
echo 
"</ul>\n";

?>