Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- ['translationID'] => 1,
- ['locale'] => 'nl_BE',
- ['translation'] => 'U bent aangemeld'
- ]
- [
- ['translationID'] => 2,
- ['locale'] => 'de_DE',
- ['translation'] => 'Sie sind angemeldet als'
- ]
- $arr = array(
- array("translationID" => "1","locale" => "nl_BE","translation" => "U bent aangemeld"),
- array("translationID" => "2","locale" => "de_DE","translation" => "Sie sind angemeldet als")
- );
- function cmp($a, $b) {
- if ($a["locale"] == $b["locale"]) {
- return 0;
- }
- return ($a["locale"] < $b["locale"]) ? -1 : 1;
- }
- usort($arr,"cmp");
- $arr = [
- ["translationID" => "1","locale" => "nl_BE","translation" => "U bent aangemeld"],
- ["translationID" => "2","locale" => "de_DE","translation" => "Sie sind angemeldet als"]
- ];
- usort($arr, function($x, $y)
- {
- return $x['locale']<$y['locale']?-1:$x['locale']!=$y['locale'];
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement