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
[edit] Last updated: Fri, 25 May 2012

view this page in

GlobIterator::__construct

(PHP 5 >= 5.3.0)

GlobIterator::__constructConstruit un itérateur de type glob

Description

public GlobIterator::__construct ( string $path [, int $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 
'No matches';
}
else
{
    
$n 0;

    
printf("Matched  %d item(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.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites