PHP sort

by Nathan Lyle <nathan(at)upwebmaestro.com>

 Date:  Sat, 25 Jan 2003 19:35:08 -0500
 To:  hwg-techniques <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
An array of table row strings passed through the "natsort" PHP
function is turning out the following:

10 - Straighten Up And Fly Right 00:08:09
11 - It Might As Well Be Spring 00:06:51 
12 - Seven Come Eleven 00:03:40 
13 - Smile 00:05:59 
1 - (Meet The) Flinstones 00:02:59 
2-10 - My One And Only Love 00:06:15 
2-11 - Corcovado (Quiet Nights) 00:07:35 
2-1 - I'll Remember April 00:06:28 
2-2 - Polkadots And Moonbeams 00:05:12 
2-3 - Lester Leaps In 00:05:43 
2-4 - I Told You I Love You. Now Get Out 00:06:06 
2-5 - Secret Love 00:05:15 
2-6 - In The Wee Small Hours Of The Morning 00:04:23 
2-7 - High Heel Sneakers 00:07:54 
2-8 - Renewal 00:08:45 
2-9 - I Love You 00:05:16 
2 - Body And Soul 00:06:07 
3 - Small Fry 00:03:50 
4 - When Lights Are Low 00:06:48 
5 - Triple Treat Blues 00:06:29 
6 - Fungi Mama 00:03:46 
7 - Sweet Lady 00:05:49 
8 - But Not For Me 00:04:56 
9 - Lined With A Groove 00:05:15

Which is different than what I'd expected... no matter how long I
stare at the results, I can't figure out what I'm misunderstanding.
Using "sort" instead gives the results I'd expect (but not the ones
I'd want)

The array values each look something like this (minus line breaks):

$trackline[] = "<.tr><.td class=\"trackView\" valign=\"top\"
            align=\"right\" nowrap=\"nowrap\">2-10</td>
            <.td class=\"trackView\" valign=\"top\">
            -</td><.td class=\"trackView\" valign=\"top\">My One
            And Only Love</td><.td class=\"trackView\"
            valign=\"top\">00:06:15</td></tr>";

And then I do:

natsort($trackline)

and then print each member of the newly sorted array.

Is it something obvious I'm missing?
                         
~ Nathan Lyle (The U.P. Web Maestro)
 
     Web: www.upwebmaestro.com  E-Mail: nathan(at)upwebmaestro.com     
     Phone: (906)485-4806

    "The only people who have anything to fear from free software 
     (such as GNAT) are those whose products are worth even less." - David Emer

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA