Skip to content

magento 2 bring key to first in customer address

i have multidimension array as below.

[
  {
    "id": 45308,
    "firstname": "Sanku Pradeep"
  },
  {
    "id": 45309,
    "firstname": "Sanku"
  },
  {
    "id": 45310,
    "firstname": "sanku"
  },
  {
    "id": 45311,
    "firstname": "sanku"
  },
  {
    "id": 45312,
    "firstname": "abhi"
  }
]

i want to bring value with “id”: 45310 to first as below.

[
  {
    "id": 45310,
    "firstname": "sanku"
  },
  {
    "id": 45308,
    "firstname": "Sanku Pradeep"
  },
  {
    "id": 45309,
    "firstname": "Sanku"
  },
  {
    "id": 45311,
    "firstname": "sanku"
  },
  {
    "id": 45312,
    "firstname": "abhi"
  }
]