GepComty

Untitled

Feb 5th, 2014
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2. $array= Array
  3. (
  4. "RT III" => 3,
  5. "RT II" => 2,
  6. "RT I" => 2,
  7. "RT V" => 1,
  8. "RT IV" => 4,
  9. "RT IX" => 4,
  10. "RT X" => 4,
  11. "RT XI" => 5,
  12. );
  13.  
  14.  
  15.  
  16. foreach($array as $key=>$val){
  17. $data2[$val][] = $key;
  18.  
  19. }
  20. krsort($data2);
  21.  
  22. $i = 1;
  23. $finish = false;
  24. foreach($data2 as $array2){
  25. foreach($array2 as $value){
  26. echo $value.' ';
  27. if($i >= 2){
  28. $finish = true;
  29. break;
  30. }
  31. $i++;
  32. }
  33. if($finish) break;
  34. }
  35. harusnya outputnya :
  36. RT XI
  37. RT IV ,RT IX, RT X
Advertisement
Add Comment
Please, Sign In to add comment