Re: readdir(), opendir()

From: Date: Thu, 29 May 2003 19:53:27 +0000
Subject: Re: readdir(), opendir()
References: 1 2  Groups: php.general.es 
Request: Send a blank email to general-es+get-36793@lists.php.net to get a copy of this message
Errata, para hacer un push se usa array_push(). http://www.php.net/manual/es/function.array-push.php ----- Original Message ----- From: "Pablo E. Siciliano" <psiciliano@puentenet.com> To: <lista@phpes.com>; "Esteban Fernández" <efernandez@tecsol.cl> Sent: Thursday, May 29, 2003 3:40 PM Subject: Re: [PHP-ES] readdir(), opendir() > No se en que orden devuelve los archivos, pero seguro no es cualquiera!!! :) > Hasta adonde se, no te queda otra que leelos secuencialmente, hacer un pop a > un array con cada uno (push()), y ordenarla (sort()). > > > ----- Original Message ----- > From: "Esteban Fernández" <efernandez@tecsol.cl> > To: <lista@phpes.com> > Sent: Thursday, May 29, 2003 3:04 PM > Subject: [PHP-ES] readdir(), opendir() > > > > Estimados > > > > Como lo puedo hacer para que al momento de abrir un directorio, y listar > los > > archivos en él, los archivos puedan salir ordenados alfabéticamente ? > > > > <?php > > $handle=opendir('.'); > > while ($file = readdir($handle)) { > > if ($file != "." && $file != "..") { > > echo "$file\n"; > > } > > } > > closedir($handle); > > ?> > > > > Ya que el resultado, me envía los archivos del directorio en cualquier > > orden. Gracias por adelantado. > > > > -- > > Esteban Fernández T. > > > > > > > > --------------------------------------------------------------------- > > Archivo On-line: http://www.phpes.com/ > > via news: news://news.phpes.com/ > > Manual PHP en español: http://www.php.net/manual/es/ > > Para dar de baja la suscripción, mande un mensaje a: > > lista-unsubscribe@phpes.com > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/03 > > > --------------------------------------------------------------------- > Archivo On-line: http://www.phpes.com/ > via news: news://news.phpes.com/ > Manual PHP en español: http://www.php.net/manual/es/ > Para dar de baja la suscripción, mande un mensaje a: > lista-unsubscribe@phpes.com > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/03

« previous php.general.es (#36793) next »