downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

GlobIterator::count> <GlobIterator
Last updated: Fri, 14 Aug 2009

view this page in

GlobIterator::__construct

(PHP 5 >= 5.3.0)

GlobIterator::__constructConstruit un itérateur de type glob

Description

GlobIterator::__construct ( string $path [, integer $flags= FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO ] )

Construit un itérateur de type glob.

Liste de paramètres

path

Le chemin du dossier.

flags

Les options, qui peuvent être un champ de bits de constantes de classe FilesystemIterator.

Exemples

Exemple #1 Exemple avec GlobIterator

<?php
$iterator 
= new GlobIterator('*.dll'FilesystemIterator::KEY_AS_FILENAME);

if(!
$iterator->count())
{
    echo 
'Rien trouvé';
}
else
{
    
$n 0;

    
printf("Trouvé %d élément(s)\r\n"$iterator->count());

    foreach(
$iterator as $item)
    {
        
printf("[%d] %s\r\n", ++$n$iterator->key());
    }
}
?>

L'exemple ci-dessus va afficher quelque chose de similaire à :

Matched 2 item(s)
[1] php5ts.dll
[2] php_gd2.dll

Voir aussi



add a note add a note User Contributed Notes
GlobIterator::__construct
There are no user contributed notes for this page.

GlobIterator::count> <GlobIterator
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites