Ich versuche, JSON -Array nach Schlüssel in PHP zu sortieren. Obwohl ich usort < /b> benutze, funktioniert es nicht.$data = [
{
"profile_name": "J3S",
"post_count": 9
},
{
"profile_name": "John",
"post_count": 3
},
{
"profile_name": "sato",
"post_count": 10
}
]
< /code>
Ich möchte das Array nach post_count sortieren.
Hier ist mein Code, den ich ausprobiert habe. < /p>
$data = json_encode($data, true);
usort($data, function ($a, $b) {
return $a['post_count'] $b['post_count'];
});
< /code>
Könnten Sie mir bitte helfen? < /p>
Sortieren Sie ein 2D -Array in PHP nach einer Spalte ⇐ Php
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Synchron ein Array sortieren, indem Sie ein anderes Array sortieren [Duplikat]
by Anonymous » » in Php - 0 Replies
- 23 Views
-
Last post by Anonymous
-