Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] jak ustawic tablice od najwiekszej wartosci
AndyPSV
post
Post #1





Grupa: Zarejestrowani
Postów: 393
Pomógł: 5
Dołączył: 6.02.2003
Skąd: The.Luciferian.Doctrine.p
df

Ostrzeżenie: (30%)
XX---


Mam takie cos, chce ustawic ta tablice po najwiekszej wartosci "e_months0" (teraz jest dobrze ustawiona, ale jak zrobic skrypt, ktory by ustawial ja?):

  1. 0 =>
  2. 'id' => '1',
  3. 'nick' => 'AndyPSV',
  4. 'status' => 'admin',
  5. 'first_name' => 'Andrzej Jeziorski',
  6. 'c_months3' => 0,
  7. 'c_months1' => 0,
  8. 'c_months0' => 5,
  9. 'c_months_now' => 3,
  10. 'e_months3' => '',
  11. 'e_months1' => '',
  12. 'e_months0' => '100',
  13. 'this_month' => 500,
  14. ),
  15. 1 =>
  16. 'id' => '2',
  17. 'nick' => 'Toruniak',
  18. 'status' => 'caller',
  19. 'first_name' => '',
  20. 'c_months3' => 0,
  21. 'c_months1' => 0,
  22. 'c_months0' => 0,
  23. 'c_months_now' => 0,
  24. 'e_months3' => '',
  25. 'e_months1' => '',
  26. 'e_months0' => '',
  27. 'this_month' => 0,
  28. ),
  29. )
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
AndyPSV
post
Post #2





Grupa: Zarejestrowani
Postów: 393
Pomógł: 5
Dołączył: 6.02.2003
Skąd: The.Luciferian.Doctrine.p
df

Ostrzeżenie: (30%)
XX---


prosilbym o kod, gdybym wiedzial jak to zrobic nie prosilbym o pomoc
jak to zrobic?

dziala! zrobione, dzieki

  1. <?php
  2.  
  3. $array = array (
  4. 0 =>
  5. 'id' => '1',
  6. 'nick' => 'AndyPSV',
  7. 'status' => 'admin',
  8. 'first_name' => 'Andrzej Jeziorski',
  9. 'c_months3' => 0,
  10. 'c_months1' => 0,
  11. 'c_months0' => 5,
  12. 'c_months_now' => 3,
  13. 'e_months3' => '',
  14. 'e_months1' => '',
  15. 'e_months0' => '100',
  16. 'this_month' => 500,
  17. ),
  18. 1 =>
  19. 'id' => '2',
  20. 'nick' => 'Toruniak',
  21. 'status' => 'caller',
  22. 'first_name' => '',
  23. 'c_months3' => 0,
  24. 'c_months1' => 0,
  25. 'c_months0' => 0,
  26. 'c_months_now' => 0,
  27. 'e_months3' => '',
  28. 'e_months1' => '',
  29. 'e_months0' => '50',
  30. 'this_month' => 0,
  31. ),
  32. 2 =>
  33. 'id' => '2',
  34. 'nick' => 'Toruniak',
  35. 'status' => 'caller',
  36. 'first_name' => '',
  37. 'c_months3' => 0,
  38. 'c_months1' => 0,
  39. 'c_months0' => 0,
  40. 'c_months_now' => 0,
  41. 'e_months3' => '',
  42. 'e_months1' => '',
  43. 'e_months0' => '400',
  44. 'this_month' => 0,
  45. ),
  46. );
  47.  
  48. usort($array, create_function('$a,$b','return $b["e_months0"] - $a["e_months0"];'));
  49.  
  50. echo '<pre>'.var_export($array);
  51.  
  52. ?>



Ten post edytował AndyPSV 12.09.2010, 13:41:15
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: 11.10.2025 - 05:01