(PECL eio >= 0.0.1dev)
eio_readdir — Leer un directorio al completo
$path
   , int $flags
   , int $pri
   , callable $callback
   [, string $data = NULL
  ] ) : resource
     Leer un directorio al completo (mediante las llamadas al sistema de opendir,
     readdir y closedir) y devuelve o los nombres o un array en
     el argumento result de la función callback,
     dependiendo del argumento flags.
    
pathLa ruta del directorio.
flagsUna combinación de constantes EIO_READDIR_*.
priLa prioridad de petición: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, o NULL.
Si se pasa NULL, pri es establecido internamente a
EIO_PRI_DEFAULT.
callback
La función callback es llamada cuando la petición está hecha.
Debería seguir el siguiente prototipo: 
void callback(mixed $data, int $result[, resource $req]);
datason datos personalizados pasados a la petición.
resultes el valor del resultado específico de la petición; básicamente, el valor devuelto por la correspondiente llamada al sistema.
reqes el recurso de petición opcional que puede usarse con funciones como eio_get_last_error()
data
         Variable arbitraria pasada a callback.
        
      eio_readdir() devuelve un recurso de petición en caso de éxito, o
      FALSE en caso de error. Establece el argumento result de
      la función callback function según
      el parámetro flags:
     
EIO_READDIR_DENTS
         (integer)
        EIO_READDIR_DIRS_FIRST
         (integer)
        EIO_READDIR_STAT_ORDER
         (integer)
        EIO_READDIR_FOUND_UNKNOWN
         (integer)
        Tipos de nodos:
EIO_DT_UNKNOWN
         (integer)
        EIO_DT_FIFO
         (integer)
        EIO_DT_CHR
         (integer)
        EIO_DT_MPC
         (integer)
        EIO_DT_DIR
         (integer)
        EIO_DT_NAM
         (integer)
        EIO_DT_BLK
         (integer)
        EIO_DT_MPB
         (integer)
        EIO_DT_REG
         (integer)
        EIO_DT_NWK
         (integer)
        EIO_DT_CMP
         (integer)
        EIO_DT_LNK
         (integer)
        EIO_DT_SOCK
         (integer)
        EIO_DT_DOOR
         (integer)
        EIO_DT_WHT
         (integer)
        EIO_DT_MAX
         (integer)
        Ejemplo #1 eio_readdir() example
<?php
/* Es llamada cuando eio_readdir() finaliza */
function mi_llamada_retorno_readdir($datos, $resultado) {
    echo __FUNCTION__, " llamada\n";
    echo "datos: "; var_dump($datos);
    echo "resultado: "; var_dump($resultado);
    echo "\n";
}
eio_readdir("/var/spool/news", EIO_READDIR_STAT_ORDER | EIO_READDIR_DIRS_FIRST,
  EIO_PRI_DEFAULT, "mi_llamada_retorno_readdir");
eio_event_loop();
?>
El resultado del ejemplo sería algo similar a:
mi_llamada_retorno_readdir llamada
datos: NULL
resultado: array(2) {
 ["names"]=>
  array(7) {
   [0]=>
    string(7) "archive"
    [1]=>
    string(8) "articles"
    [2]=>
    string(8) "incoming"
    [3]=>
    string(7) "innfeed"
    [4]=>
    string(8) "outgoing"
    [5]=>
    string(8) "overview"
    [6]=>
    string(3) "tmp"
  }
 ["dents"]=>
  array(7) {
   [0]=>
    array(3)
    {
     ["name"]=>
      string(7)
      "archive"
      ["type"]=>
      int(4)
      ["inode"]=>
      int(393265)
    }
   [1]=>
    array(3)
    {
     ["name"]=>
      string(8)
      "articles"
      ["type"]=>
      int(4)
      ["inode"]=>
      int(393266)
    }
   [2]=>
    array(3)
    {
     ["name"]=>
      string(8)
      "incoming"
      ["type"]=>
      int(4)
      ["inode"]=>
      int(393267)
    }
   [3]=>
    array(3)
    {
     ["name"]=>
      string(7)
      "innfeed"
      ["type"]=>
      int(4)
      ["inode"]=>
      int(393269)
    }
   [4]=>
    array(3)
    {
     ["name"]=>
      string(8)
      "outgoing"
      ["type"]=>
      int(4)
      ["inode"]=>
      int(393270)
    }
   [5]=>
    array(3)
    {
     ["name"]=>
      string(8)
      "overview"
      ["type"]=>
      int(4)
      ["inode"]=>
      int(393271)
    }
   [6]=>
    array(3)
    {
     ["name"]=>
      string(3)
      "tmp"
      ["type"]=>
      int(4)
      ["inode"]=>
      int(393272)
    }
  }
}