Re: Multi-Sort -- how to do this?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 > Ash:

 You missed the point. I could use the built-in sort (i.e., sort() )
 and sort the $d array. However, I would like the indexes of the other
 arrays to match the new sort.

 Cheers,

 > tedd
 >
I think I might need a for-instance here, as you lost me!

Thanks
Ash


Ash:

You can sort any array by using the "built-in" php function sort() -- try it.

After you try it, you'll find that the array is sorted but the order of the values are not as they were before. In other words, the index-value pairs are different. Here's an example:

http://www.webbytedd.com/bbbb/sort/

Before the sort, the value 'red' is located in the $a array under index 0

After the sort, the value 'red' is still in the $a array but under index 2. Note, the values of the indexes have changed.

My query was simply how to sort one array (order it) while ordering the values of other arrays in the same manner.

The multisort() function does that as seen here:

http://www.webbytedd.com/bbbb/multisort/

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux