0

i want my foreach loop test specefic $key of "age"from my associative decoded json data for example and ascending or descendig sort whole array by value of "age" can anyone help me?

[
  {
    "number": 1,
    "name": "masoud ahmadi",
    "age": 16,
    "school": "Amir kabir"
  },
  {
    "number": 2,
    "name": "mohammad hosseini",
    "age": 14,
    "school": "Andishe"
  },
  {
    "number": 3,
    "name": "Mohammad hosseini",
    "age": 14,
    "school": "Allame"
  },
  {
    "number": 4,
    "name": "ali akabr",
    "age": 16,
    "school": "Allame"
  }
]
waterloomatt
  • 3,662
  • 1
  • 19
  • 25
  • Convert your JSON to an array using `json_decode($jsonString, true)` then see https://stackoverflow.com/q/1597736/296555. – waterloomatt Jun 23 '22 at 16:46
  • Why was this question upvoted? It is a super-duplicate requirements-dump question and showed absolutely no research or effort? ...this is actually part of the hardcoded definition for why a question should be downvoted. Mouseover the up/downvote buttons to understand how to vote. – mickmackusa Jun 24 '22 at 01:08

0 Answers0