# How to sort this Multi-D array?

**URL:** <https://forum.kirupa.com/t/how-to-sort-this-multi-d-array/281930>\
**Category:** flash\
**Created:** [February 15, 2009, 3:25pm UTC](https://forum.kirupa.com/t/how-to-sort-this-multi-d-array/281930 "2009-02-15T15:25:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikomax](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nikomax/32/3664_2.png) [@nikomax](https://forum.kirupa.com/u/nikomax)\
**Post date:** [February 15, 2009, 3:25pm UTC](https://forum.kirupa.com/t/how-to-sort-this-multi-d-array/281930/1 "2009-02-15T15:25:45Z")

</div>

EDIT::  
Just realised I could of asked this a lot shorter =/  
How / Can I use array.push() to make an associative array that keeps its order the way I added the item?

Sorry if this is confusing!!

ORIGINAL::  
So I have this Multidimensional array that stores objects that are sorted into groups.

The array structure looks like this:

```auto

Array{

    V{obj,obj,obj etc...}

    K{obj,obj,obj etc...}

    S{obj,obj,obj etc...}

    T{obj,obj,obj etc...}

    N{obj,obj,obj etc...}

 And so on...
}

```

I have been adding these groups to the main array like this, because I need to be able to pull certain groups from the array.

```auto

array['V'] = array{obj,obj,obj etc...};
array['K'] = array{obj,obj,obj etc...};
array['S'] = array{obj,obj,obj etc...};
array['T'] = array{obj,obj,obj etc...};
array['N'] = array{obj,obj,obj etc...};

```

Now this all works fine, until I want to loop through the array and print the groups in order. The order of the groups is not kept from how I added them.

So I thought about adding them using the array function push() but how do I do this do its associative?
