sorting...

They have: 447 posts

Joined: Oct 1999

say i have a list like this:

47:15:20
11:4:6
47:15:1
3:22:45
22:4:88
3:6:81

$a<=>$b sorts up to the first semicolon only. I need to sort by the first number, then the second number, then the third.

They have: 99 posts

Joined: May 1999

Probably not the best way, but it works..

Why dont you split the string and assign to a set of associative arrays. Use Key/Value pairing with Key being the common thread for each split list.

If you want to sort by first and then if first matches, sort by second, etc...you can embed the tests

[Edited by tazman on 07-15-2000 at 01:50 PM]

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.