Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] sortowanie tablicy
tomekp
post
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
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
tomekp
post
Post #2





Grupa: Zarejestrowani
Postów: 171
Pomógł: 0
Dołączył: 17.12.2003
Skąd: Krakół

Ostrzeżenie: (0%)
-----


Po to, że jak mam obsługiwać 50tyś domen, to każde zapytanie do bazy jest ważne (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Cienki1980
post
Post #3





Grupa: Przyjaciele php.pl
Postów: 1 590
Pomógł: 40
Dołączył: 11.01.2007
Skąd: Centrum

Ostrzeżenie: (0%)
-----


Cytat(tomekp @ 15.01.2007, 20:19:21 ) *
Po to, że jak mam obsługiwać 50tyś domen, to każde zapytanie do bazy jest ważne (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Przy 50 tysięcy wpisów ... to stanowczo wolałbym zrobić więcej zapytań do bazy .. niż sortować tablicę w php.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 14:06