![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 171 Pomógł: 0 Dołączył: 17.12.2003 Skąd: Krakół Ostrzeżenie: (0%) ![]() ![]() |
Mam tablicę formatu:
Kod [response] => Array ( [domaininfo] => Array ( [0] => Array ( [record_id] => 5416 [name] => test.pl [type] => MX [value] => test.pl [ttl] => 86400 [prio] => 10 [reverse_name] => pl.test [subdomain_level] => 0 ) [1] => Array ( [record_id] => 5415 [name] => test.pl [type] => A [value] => 195.149.227.83 [ttl] => 86400 [prio] => 0 [reverse_name] => pl.test [subdomain_level] => 0 ) [2] => Array ( [record_id] => 5418 [name] => *.test.pl [type] => A [value] => 195.149.227.83 [ttl] => 86400 [prio] => 0 [reverse_name] => pl.test.* [subdomain_level] => 0 ) [3] => Array ( [record_id] => 5417 [name] => test.pl [type] => TXT [value] => v=spf1 a mx -all [ttl] => 86400 [prio] => 0 [reverse_name] => pl.test [subdomain_level] => 0 ) [4] => Array ( [record_id] => 5419 [name] => *.test.pl [type] => MX [value] => test.pl [ttl] => 86400 [prio] => 10 [reverse_name] => pl.test.* [subdomain_level] => 0 ) [5] => Array ( [record_id] => 5420 [name] => *.test.pl [type] => TXT [value] => v=spf1 a mx -all [ttl] => 86400 [prio] => 0 [reverse_name] => pl.test.* [subdomain_level] => 0 ) [6] => Array ( [record_id] => 5414 [name] => test.pl [type] => NS [value] => ns2.tomekp.rix.pl [ttl] => 86400 [prio] => 0 [reverse_name] => pl.test [subdomain_level] => 0 ) [7] => Array ( [record_id] => 5413 [name] => test.pl [type] => NS [value] => ns1.tomekp.rix.pl [ttl] => 86400 [prio] => 0 [reverse_name] => pl.test [subdomain_level] => 0 ) [8] => Array ( [record_id] => 5421 [name] => test.pl [type] => SOA [value] => ns3.tomekp.rix.pl admin.tomekp.rix.pl 2007011501 10800 1800 604800 86400 [ttl] => 86400 [prio] => 0 [reverse_name] => pl.test [subdomain_level] => 0 ) ) Potrzebuję ją przesortować, najpierw według SOA,NS, a nasŧępnie po name i type, w kolejności, najpierw główna nazwa domeny, w tym przypadku test.pl, później wildcard *.test.pl przy czym rekordy dla test.pl i wildcard, mają być posortowane po typie tj. MX,A,TXT. Jak mogę osiągnąć coś takiego, podejrzewam, że chodzi o napisanie funkcji porównującej do usort, ale nie mam pojęcia jak to zrobić. Ten post edytował tomekp 17.01.2007, 11:01:15 |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 171 Pomógł: 0 Dołączył: 17.12.2003 Skąd: Krakół Ostrzeżenie: (0%) ![]() ![]() |
Sortujesz tablicę dla danej strefy, góra 100 wpisów myślę.
|
|
|
![]()
Post
#3
|
|
Grupa: Przyjaciele php.pl Postów: 1 590 Pomógł: 40 Dołączył: 11.01.2007 Skąd: Centrum Ostrzeżenie: (0%) ![]() ![]() |
Sortujesz tablicę dla danej strefy, góra 100 wpisów myślę. No to skoro będzie to jednak zapytanie dotyczące 100 wpisów a nie 50 tysiecy .... to i tak lepiej to umieścić w bazie danych, niż sortować w php. Co do samego sortowania, kombinowałbym coś z tablicami, gdzie byłaby zapisana kolejność sortowania, a że chcesz aby było posortowane po dwóch wartościach to dwie takie tablice, odpowiednio ułożone pętle i mnóstwo warunków. Stanowczo robiłbym zapytanie do SQL'a (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) |
|
|
![]() ![]() |
![]() |
Aktualny czas: 16.10.2025 - 00:03 |