★ wanayoo — archive 1999 http://fr.php.net/manual/fi/function.glob.phpNouvelle recherche | Portail wanayoo
PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previousfwriteis_dirnext
Last updated: Tue, 28 May 2002
view the printer friendly version or the printer friendly version with notes or change language to English | Brazilian Portuguese | Czech | Dutch | French | German | Hungarian | Italian | Japanese | Korean | Polish | Romanian | Russian | Slovak | Spanish | Swedish

glob

(PHP 4 CVS only)

glob -- Find pathnames matching a pattern

Description

array glob ( string pattern [, int flags])

The glob() function searches for all the pathnames matching pattern according to the rules used by the shell. No tilde expansion or parameter substitution is done.

Returns an array containing the matched files/directories or FALSE on error.

Huomaa: This function is disabled in safe mode and therefore will always return FALSE in safe mode.

Esimerkki 1. Convenient way how glob() can replace opendir() and friends.

foreach (glob("*.txt") as $filename) {
    echo "$filename size " . filesize($filename) . "\n";
}

This could result in the following output:

funclist.txt size 44686
funcsummary.txt size 267625
quickref.txt size 137820

See also opendir(), readdir() and closedir().

User Contributed Notes
glob
add a note about notes
opessin at ifrance dot com
07-Jul-2002 10:48

If this function is not available in your version of PHP, think looking at the 'Directory Functions' which can be used instead.
http://www.php.net/manual/en/ref.dir.php

leon at leonatkinson dot com
18-Oct-2002 01:03

Since this function is a wrapper for the OS function of the same name, you may find it helpful to look at the man page while the exact PHP implementation is sorted out.

You might have some luck passing in the literal values of the constants defined in /usr/include/glob.h.  For example, GLOB_NOSORT is defined as (1 << 2), which is 4.  In PHP, glob('*.php', 4) will returns an unsorted list for me in RH 7.x.  YMMV.

add a note about notes
previousfwriteis_dirnext
Last updated: Tue, 28 May 2002
show source | credits | stats | mirror sites
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: nexen.net
Last updated: Sat Nov 23 04:10:11 2002 CET