Hello,
$_location = Array
(
[0] => Array
(
[id] => 22
[stadt] => Barcelona
[x] => 283
[y] => 158
)[1] => Array
(
[id] => 17
[stadt] => Brüssel
[x] => 285
[y] => 140
)[2] => Array
(
[id] => 27
[stadt] => Buenos Aires
[x] => 179
[y] => 300usw....usw....usw
[29] => Array
(
[id] => 0
[stadt] => Tokio
[x] => 502
[y] => 169
)[30] => Array
(
[id] => 21
[stadt] => Bagdad
[x] => 20
[y] => 20
)
}
Schau Dir mal auf http://de3.php.net/manual/de/function.usort.php
das Beispiel mit den Früchten an. Das ist hier direkt anwendbar.
Callbackfunktion:
function cmp ($a, $b)
{
return strcmp($a['stadt'], $b['stadt']);
}
und Sortierbefehl:
usort($_location, 'cmp');
Alternativ kannst Du das Array auch gleich als "Spaltenarray" aufbauen
$_location['id'][1] =
$_location['stadt'][1]=
$_location['x'][1] =
$_location['y'][1] =
$_location['id'][2] =
$_location['stadt'][2]=
$_location['x'][2] =
$_location['y'][2] =
Dann kann man nämlich jede "Spalte" mit der normalen Sortierfunktion sortieren und dann entlang dieser Spalte ausgeben:
http://forum.de.selfhtml.org/archiv/2005/3/t102531/#m630684
http://forum.de.selfhtml.org/archiv/2004/11/t95172/#m576956
Harzliche Grüße aus http://www.annerschbarrich.de
Tom
Fortschritt entsteht nur durch die Auseinandersetzung der Kreativen
Nur selber lernen macht schlau