![]() |
How to sort a multi-array
I have an array like this
PHP Code:
PHP Code:
|
I believe asort is what your looking for.
PHP Code:
I am not to sure if this is exactly what you are looking for. If you could provide a more accurate example as if I were to build a recursive function for this (multi-dim array); It would need to start at the deepest array and work back to the beginning (what string value does an array have?) if you see what I mean. |
From where do you get your array? Database or somewhere else?
Can you provide more info? |
Quote:
PHP Code:
|
Quote:
PHP Code:
|
Is this a solution to your problems?
PHP Code:
Code:
Array |
No, that doesn't work. What does $_compile[$row] represent? I tried inserting the array name there but it didn't work either. The code I posted does seem to work. Is there anything wrong with using a for loop?
|
Hi Benton,
So what I understand is that you will have a key index housing a sub-array. So what you gave will work perfectly fine. PHP Code:
You do not need to go backwards with this; I thought you actually needed to traverse (crawl down) the array. |
Thanks for letting me know. I've tried a bunch of tests and it seems to work fine. Thanks for providing the code to make it work.
|
| All times are GMT. The time now is 09:01 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0