Skip to content
Advertisement

How to Rearrange an mutlidimensional array in a custom order

I’am trying to rearrange an mutlidimensional array in a to a custom order. I’am matching the keys and if these key are present in an other array it should move to the top. I couldn’t find any thing on the web nor any php functions that can do this.

JavaScript

Some code that I already have tried

JavaScript

Advertisement

Answer

You can use foreach() loop to do so:

JavaScript

https://3v4l.org/BmZmj

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement