![]() Preserved Topic: Sorting flat text files |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() I have a flat text file delimited with pipes that looks like this: |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
![]() Read all lines from your text file into array, write function that compares two date items, use usort() function to sort array using your date comparing function... |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() Thanks for the start mr.maX! |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() Okay, after mr.maX pointed me in the right direction, and after spending some time in the online PHP manual (I love that thing), I have come up with this code. Whats even more amazing is... IT WORKS! I'm just not sure why. I know I've made $my_array a two dimentional array, which is why I'm having trouble understanding why this works. What makes the sort function sort on the date field which would be $my_array[0][0], and $my_array[1][1], ect. if my thinking is correct. |
Paranoid (IV) Inmate From: Minneapolis, MN, USA |
![]() $my_array is an array of arrays (each of which contains one row's worth of values) |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
![]() Actually, I haven't suggested that you use sort() function, Butcher |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() Thanks mr.maX |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() I'm sorry jiblet, |