Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. [
  2. ['translationID'] => 1,
  3. ['locale'] => 'nl_BE',
  4. ['translation'] => 'U bent aangemeld'
  5. ]
  6. [
  7. ['translationID'] => 2,
  8. ['locale'] => 'de_DE',
  9. ['translation'] => 'Sie sind angemeldet als'
  10. ]
  11.  
  12. $arr = array(
  13. array("translationID" => "1","locale" => "nl_BE","translation" => "U bent aangemeld"),
  14. array("translationID" => "2","locale" => "de_DE","translation" => "Sie sind angemeldet als")
  15. );
  16.  
  17. function cmp($a, $b) {
  18. if ($a["locale"] == $b["locale"]) {
  19. return 0;
  20. }
  21. return ($a["locale"] < $b["locale"]) ? -1 : 1;
  22. }
  23. usort($arr,"cmp");
  24.  
  25. $arr = [
  26. ["translationID" => "1","locale" => "nl_BE","translation" => "U bent aangemeld"],
  27. ["translationID" => "2","locale" => "de_DE","translation" => "Sie sind angemeldet als"]
  28. ];
  29.  
  30. usort($arr, function($x, $y)
  31. {
  32. return $x['locale']<$y['locale']?-1:$x['locale']!=$y['locale'];
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement