Re: sorting array
| From: | Ignatius Teo | Date: | Wed, 12 Dec 2001 22:29:52 +0000 |
| Subject: | Re: sorting array | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-10860@lists.php.net to get a copy of this message | ||
try
$array_eng[$date] = $file;
inside your while loop
Ignatius
----- Original Message -----
From: "Adam Smith" <martinwrong@hotmail.com>
To: <php-windows@lists.php.net>
Sent: Wednesday, December 12, 2001 11:52 PM
Subject: [PHP-WIN] sorting array
>
>
> Hi I'm confused with array in php.
>
>
> $array_eng=array($date => $file)
>
> In this code I read a directory and
> use the file date as key and file name as value
> but when the loop end i 've only the last file read in the array, it's
> like that the array is recreated each time.
>
> Any idea? How arrive to a results like this ( remove // print_r ... ) :
>
> Array ( [20001003] => bms031000_eng.pdf )
> Array ( [20001203] => bms031201_eng.pdf )
> Array ( [20001107] => bms071101_eng.pdf )
>
> instead of only :
>
> 20001107 -> bms071101_eng.pdf
>
> Thanls
>
>
>
> $handle=opendir($path_eng);
> while (false!==($file = readdir($handle))) {
> .
> .
> .
> .
> $array_eng=array($date => $file);
>
>
> // print_r ($array_eng);
>
> }
>
> print_r ($array_eng);
>
> _________________________________________________________________
> Scarica GRATUITAMENTE MSN Explorer dall'indirizzo
> http://explorer.msn.it/intl.asp.
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>