Re: Sorting...
| From: | Ramil Sagum | Date: | Wed, 17 Nov 2004 14:14:42 +0000 |
| Subject: | Re: Sorting... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202296@lists.php.net to get a copy of this message | ||
On Wed, 17 Nov 2004 09:03:12 -0500 (EST), Russell P Jones
<rjones@email.unc.edu> wrote:
> I have an array filled with CSV data...
>
> array (
> 20040310, Title, Author
> 20041115, Title, Author
> 20040513, Title, Author
> )
>
> where each array element is 1 line from the csv. When I go to print it
> out, Im going to explode each by , and then print it out the way I like.
>
> BUT, I want to sort them all by those first 8 digits, which happen to be
> the date. Any way to sort an array by the first x characters in its
> string?
>
How about a non php solution? Maybe sort the lines in the CSV file
first using a sort command line utility (like "sort" in *nix), sample
to a temp file, then open that file in PHP
----
ramil
http://ramil.sagum.net
--
----
ramil
http://ramil.sagum.net