glob

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

globFindet Dateinamen, die mit einem Muster übereinstimmen

Beschreibung

array glob ( string $pattern [, int $flags = 0 ] )

glob() findet Dateipfade, die mit dem angegebenen Muster pattern übereinstimmen. Die Übereinstimmung wird nach den gleichen Regeln geprüft, wie in der glob()-Funktion der C-Bibliothek und entspricht weitgehend den Regeln in den üblichen Kommandozeilen-Shells.

Parameter-Liste

pattern

Das Suchmuster. Parameter- und Tilde-Ersetzung findet nicht statt.

flags

Mögliche Flags:

  • GLOB_MARK - Fügt jedem zurückgegebenen Verzeichnis einen Slash hinzu
  • GLOB_NOSORT - Gibt Dateinamen unsortiert in der Reihenfolge ihrer Verzeichniseinträge zurück. Wenn dieses Flag nicht verwendet wird, werden die Pfadnamen alphabetisch sortiert
  • GLOB_NOCHECK - Gibt das Suchmuster zurück, wenn keine übereinstimmende Dateinamen gefunden wurden
  • GLOB_NOESCAPE - Backslashes maskieren keine Metazeichen
  • GLOB_BRACE - {a,b,c} prüft auf 'a', 'b', oder 'c'
  • GLOB_ONLYDIR - Gibt nur übereinstimmende Verzeichnisnamen zurück
  • GLOB_ERR - Anhalten bei Lesefehlern (wie nicht-lesbaren Verzeichnis), standardmäßig werden Fehler ignoriert

Rückgabewerte

Gibt ein Array mit den übereinstimmenden Datei- und Verzeichnisnamen zurück. Wenn keine Treffer gefunden wurden, wird ein leeres Array zurückgegeben und im Fehlerfall FALSE.

Hinweis:

Auf manchen Systemen ist es nicht möglich, zwischen einer leeren Ergebnismenge und einem aufgetretenen Fehler zu unterscheiden.

Changelog

Version Beschreibung
5.1.0 GLOB_ERR wurde hinzugefügt

Beispiele

Beispiel #1 Einfacher Ersatz von opendir() etc.

<?php
foreach (glob("*.txt") as $filename) {
    echo 
"$filename - Größe: " filesize($filename) . "\n";
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

funclist.txt - Größe: 44686
funcsummary.txt - Größe: 267625
quickref.txt - Größe: 137820

Anmerkungen

Hinweis: Diese Funktion kann nicht mit entfernten Dateien arbeiten, da der Zugriff auf die Datei, die bearbeitet werden soll, über das Dateisystem des Servers möglich sein muss.

Hinweis: Diese Funktion ist nicht auf allen Systemen verfügbar (z.B. nicht auf alten Sun-OS-Versionen).

Hinweis: Das GLOB_BRACE-Flag ist auf einigen nicht-GNU-Systemen (wie Solaris) nicht verfügbar.

Siehe auch

  • opendir() - Öffnen eines Verzeichnis-Handles
  • readdir() - Liest einen Eintrag aus einem Verzeichnis-Handle
  • closedir() - Schließen eines Verzeichnis-Handles
  • fnmatch() - Match filename against a pattern

add a note add a note

User Contributed Notes 52 notes

up
253
crayonviolent at phpfreaks dot com
8 years ago
Since I feel this is rather vague and non-helpful, I thought I'd make a post detailing the mechanics of the glob regex.

glob uses two special symbols that act like sort of a blend between a meta-character and a quantifier.  These two characters are the * and ?

The ? matches 1 of any character except a /
The * matches 0 or more of any character except a /

If it helps, think of the * as the pcre equivalent of .* and ? as the pcre equivalent of the dot (.)

Note: * and ? function independently from the previous character. For instance, if you do glob("a*.php") on the following list of files, all of the files starting with an 'a' will be returned, but * itself would match:

a.php // * matches nothing
aa.php // * matches the second 'a'
ab.php // * matches 'b'
abc.php // * matches 'bc'
b.php // * matches nothing, because the starting 'a' fails
bc.php // * matches nothing, because the starting 'a' fails
bcd.php // * matches nothing, because the starting 'a' fails

It does not match just a.php and aa.php as a 'normal' regex would, because it matches 0 or more of any character, not the character/class/group before it.

Executing glob("a?.php") on the same list of files will only return aa.php and ab.php because as mentioned, the ? is the equivalent of pcre's dot, and is NOT the same as pcre's ?, which would match 0 or 1 of the previous character.

glob's regex also supports character classes and negative character classes, using the syntax [] and [^]. It will match any one character inside [] or match any one character that is not in [^].

With the same list above, executing

glob("[ab]*.php) will return (all of them):
a.php  // [ab] matches 'a', * matches nothing
aa.php // [ab] matches 'a', * matches 2nd 'a'
ab.php // [ab] matches 'a', * matches 'b'
abc.php // [ab] matches 'a', * matches 'bc'
b.php // [ab] matches 'b', * matches nothing
bc.php // [ab] matches 'b', * matches 'c'
bcd.php // [ab] matches 'b', * matches 'cd'

glob("[ab].php") will return a.php and b.php

glob("[^a]*.php") will return:
b.php // [^a] matches 'b', * matches nothing
bc.php // [^a] matches 'b', * matches 'c'
bcd.php // [^a] matches 'b', * matches 'cd'

glob("[^ab]*.php") will return nothing because the character class will fail to match on the first character.

You can also use ranges of characters inside the character class by having a starting and ending character with a hyphen in between.  For example, [a-z] will match any letter between a and z, [0-9] will match any (one) number, etc..

glob also supports limited alternation with {n1, n2, etc..}.  You have to specify GLOB_BRACE as the 2nd argument for glob in order for it to work.  So for example, if you executed glob("{a,b,c}.php", GLOB_BRACE) on the following list of files:

a.php
b.php
c.php

all 3 of them would return.  Note: using alternation with single characters like that is the same thing as just doing glob("[abc].php").  A more interesting example would be glob("te{xt,nse}.php", GLOB_BRACE) on:

tent.php
text.php
test.php
tense.php

text.php and tense.php would be returned from that glob.

glob's regex does not offer any kind of quantification of a specified character or character class or alternation.  For instance, if you have the following files:

a.php
aa.php
aaa.php
ab.php
abc.php
b.php
bc.php

with pcre regex you can do ~^a+\.php$~ to return

a.php
aa.php
aaa.php

This is not possible with glob.  If you are trying to do something like this, you can first narrow it down with glob, and then get exact matches with a full flavored regex engine.  For example, if you wanted all of the php files in the previous list that only have one or more 'a' in it, you can do this:

<?php
   $list
= glob("a*.php");
   foreach (
$list as $l) {
      if (
preg_match("~^a+\.php$~",$file))
        
$files[] = $l;
   }
?>

glob also does not support lookbehinds, lookaheads, atomic groupings, capturing, or any of the 'higher level' regex functions.

glob does not support 'shortkey' meta-characters like \w or \d.
up
51
uramihsayibok, gmail, com
8 years ago
Those of you with PHP 5 don't have to come up with these wild functions to scan a directory recursively: the SPL can do it.

<?php

$dir_iterator
= new RecursiveDirectoryIterator("/path");
$iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
// could use CHILD_FIRST if you so wish

foreach ($iterator as $file) {
    echo
$file, "\n";
}

?>

Not to mention the fact that $file will be an SplFileInfo class, so you can do powerful stuff really easily:

<?php

$size
= 0;
foreach (
$iterator as $file) {
    if (
$file->isFile()) {
        echo
substr($file->getPathname(), 27) . ": " . $file->getSize() . " B; modified " . date("Y-m-d", $file->getMTime()) . "\n";
       
$size += $file->getSize();
    }
}

echo
"\nTotal file size: ", $size, " bytes\n";

?>

\Luna\luna.msstyles: 4190352 B; modified 2008-04-13
\Luna\Shell\Homestead\shellstyle.dll: 362496 B; modified 2006-02-28
\Luna\Shell\Metallic\shellstyle.dll: 362496 B; modified 2006-02-28
\Luna\Shell\NormalColor\shellstyle.dll: 361472 B; modified 2006-02-28
\Luna.theme: 1222 B; modified 2006-02-28
\Windows Classic.theme: 3025 B; modified 2006-02-28

Total file size: 5281063 bytes
up
11
redcube at gmx dot de
11 years ago
Please note that glob('*') ignores all 'hidden' files by default. This means it does not return files that start with a dot (e.g. ".file").
If you want to match those files too, you can use "{,.}*" as the pattern with the GLOB_BRACE flag.

<?php
// Search for all files that match .* or *
$files = glob('{,.}*', GLOB_BRACE);
?>

Note: This also returns the directory special entries . and ..
up
15
Sam Bryan
5 years ago
glob is case sensitive, even on Windows systems.

It does support character classes though, so a case insensitive version of
<?php glob('my/dir/*.csv') ?>

could be written as
<?php glob('my/dir/*.[cC][sS][vV]') ?>
up
6
r dot hartung at roberthartung dot de
8 years ago
You can use multiple asterisks with the glob() - function.

Example:

<?php
  $paths
= glob('my/*/dir/*.php');
?>

$paths will contains paths as following examples:

- my/1/dir/xyz.php
- my/bar/dir/bar.php
- my/bar/dir/foo.php
up
10
Ultimater at gmail dot com
6 years ago
glob() isn't limited to one directory:

<?php
$results
=glob("{includes/*.php,core/*.php}",GLOB_BRACE);
echo
'<pre>',print_r($results,true),'</pre>';
?>

Just be careful when using GLOB_BRACE regarding spaces around the comma:
{includes/*.php,core/*.php} works as expected, but
{includes/*.php, core/*.php} with a leading space, will only match the former as expected but not the latter
unless you have a directory named " core" on your machine with a leading space.
PHP can create such directories quite easily like so:
mkdir(" core");
up
16
david dot schueler at tel-billig dot de
6 years ago
Don't use glob() if you try to list files in a directory where very much files are stored (>100.000). You get an "Allowed memory size of XYZ bytes exhausted ..." error.
You may try to increase the memory_limit variable in php.ini. Mine has 128MB set and the script will still reach this limit while glob()ing over 500.000 files.

The more stable way is to use readdir() on very large numbers of files:
<?php
// code snippet
if ($handle = opendir($path)) {
    while (
false !== ($file = readdir($handle))) {
       
// do something with the file
        // note that '.' and '..' is returned even
   
}
   
closedir($handle);
}
?>
up
7
Gabriel S. Luraschi
5 years ago
Use this to exclude hidden files on MS Windows.

<?php
exec
("dir \"{$path}\" /A:-H /B", $result);
?>
up
29
Mike
5 years ago
<?php

if ( ! function_exists('glob_recursive'))
{
   
// Does not support flag GLOB_BRACE
   
   
function glob_recursive($pattern, $flags = 0)
    {
       
$files = glob($pattern, $flags);
       
        foreach (
glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir)
        {
           
$files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags));
        }
       
        return
$files;
    }
}

?>
up
15
ni dot pineau at gmail dot com
5 years ago
Note that in case you are using braces with glob you might retrieve duplicated entries for files that matche more than one item :

<?php

$a
= glob('/path/*{foo,bar}.dat',GLOB_BRACE);
print_r($a);

?>

Result :
Array
(
    [0] => /path/file_foo.dat
    [1] => /path/file_foobar.dat
    [2] => /path/file_foobar.dat
)
up
5
martinlarsen at bigfoot dot com
10 years ago
glob() does not work if the path contains brackets "[" and "]".

For example, this will make it fail:

$files = glob("[myfolder]/*.txt");

No error is returned, just an empty array!
up
9
agd243 at gmail dot com
4 years ago
A simple function that find all files by extension an return it by an array.
<?php
function findFiles($directory, $extensions = array()) {
    function
glob_recursive($directory, &$directories = array()) {
        foreach(
glob($directory, GLOB_ONLYDIR | GLOB_NOSORT) as $folder) {
           
$directories[] = $folder;
           
glob_recursive("{$folder}/*", $directories);
        }
    }
   
glob_recursive($directory, $directories);
   
$files = array ();
    foreach(
$directories as $directory) {
        foreach(
$extensions as $extension) {
            foreach(
glob("{$directory}/*.{$extension}") as $file) {
               
$files[$extension][] = $file;
            }
        }
    }
    return
$files;
}
var_dump(findFiles("C:", array (

   
"jpg",
   
"pdf",
   
"png",
   
"html"
)));
?>
up
6
lesion at autistici dot org
10 years ago
Maybe all of you still know this, but it seems that if the directory contains some unresolved symlink, glob() simply ignore those files.
up
7
carlos dot lage at nospam at foo dot bar at gmail dot com
9 years ago
I lost hours looking for the solution for this problem.
glob() wasn't eating up my directory names (stuff like "foobar[]"), and I searched online for some hours, I tried preg_quote to no avail.

I finally found the proper way to escape stuff in glob() in an obscure Python mailing list:

<?php
preg_replace
('/(\*|\?|\[)/', '[$1]', $dir_path);
?>

If you want to add a directory path before your pattern, you should do it like this:

<?php
glob
(preg_replace('/(\*|\?|\[)/', '[$1]', $dir_path).'*.txt');
?>
preg_quote WILL NOT work in all cases (if any).
up
6
peter dot adrianov at gmail dot com
7 years ago
Non-recursive search files, proceeding down directory tree.

<?php
function scandir_through($dir)
{
   
$items = glob($dir . '/*');

    for (
$i = 0; $i < count($items); $i++) {
        if (
is_dir($items[$i])) {
           
$add = glob($items[$i] . '/*');
           
$items = array_merge($items, $add);
        }
    }

    return
$items;
}
?>
up
4
soywiz at gmail dot com
4 years ago
Recursive glob for PHP>=5.5

function globRecursive($path, $find) {
    $dh = opendir($path);
    while (($file = readdir($dh)) !== false) {
        if (substr($file, 0, 1) == '.') continue;
        $rfile = "{$path}/{$file}";
        if (is_dir($rfile)) {
            foreach (globRecursive($rfile, $find) as $ret) {
                yield $ret;
            }
        } else {
            if (fnmatch($find, $file)) yield $rfile;
        }
    }
    closedir($dh);
}
up
1
nuntius
8 years ago
First off, it's nice to see all of the different takes on this. Thanks for all of the great examples.

Fascinated by the foreach usage I was curious how it might work with a for loop. I found that glob was well suited for this, especially compared to opendir.  The for loop is always efficient when you want to protect against a potential endless loop.

$dir=$_SERVER['DOCUMENT_ROOT']."/test/directory_listing/test";
    echo $dir;
    $filesArray=glob($dir."/*.*");   
   
    $line.="<pre>";
    $line.=print_r($filesArray, true);
    $line.="</pre>";
    $line.="<hr>";
   
    for($i=0;$i<count($filesArray);$i++) {
        $line.=key($filesArray)." - ";   
        $line.=$filesArray[$i]."<br/>";
         next($filesArray);
    }

    echo $line;

Note that I pulled the glob array keys if you should need them.

Also you can tweak it for searches with something like this... (case sensitive)

$search_names="Somedocname";
$filesArray=glob($dir."/".$search_names."*.*");   
   
Enjoy!
up
1
heavyraptor at gmail dot com
9 years ago
glob() (array_sum() and array_map() in fact too) can be very useful if you want to calculate the sum of all the files' sizes located in a directory:

<?php
$bytes
= array_sum(array_map('filesize',glob('*')));
?>

Unfortunately there's no way to do this recursively, using glob() (as far as I know).
up
2
info at urbits dot com
11 years ago
I have been working towards a CMS-type design that is both modular and quite flat. For example, included files are all one level below the installation folder.

glob() just help me get rid of a lot of opendir() hassle. I wasn't sure if the double asterix would work - but it's fine:

foreach (glob(SERVER_PATH."/*/includes/*.php") as $inc) {
   require($inc);
}
up
3
troy at troyonline dot com
6 years ago
If you have open_basedir set in php.ini to limit which files php can execute, glob(...) will return false when there are no matching files.  If open_basedir is not set, the very same code will return an empty array in the same situation.

This is unfortunate as a seemingly innocuous change causes different functionality that breaks code like:

foreach(glob("*.ext") as $file)
...

See this link if you have any questions as to why this is so:
http://bugs.php.net/bug.php?id=47358
up
2
rene dot rathmann at gmx dot de
3 years ago
You can do a recursive file search with yield.

<?php
function findAllDirs($start) {
   
$dirStack=[$start];
    while(
$dir=array_shift($dirStack)) {
       
$ar=glob($dir.'/*',GLOB_ONLYDIR|GLOB_NOSORT);
        if(!
$ar) continue;

       
$dirStack=array_merge($dirStack,$ar);
        foreach(
$ar as $DIR)
           
yield $DIR;
    }
}

$fname='*.php';
$result=[];
foreach(
findAllDirs('/var/www/localhost') as $dir) {
   
$match=glob($dir.'/'.$fname,GLOB_NOSORT);
    if(!
$match) continue;
   
$result=array_merge($result,$match);
}

print_r($result);
?>
up
3
pope at q dot com
9 years ago
alan at ridersite dot org 18-Mar-2007 03:26 -- Stated '*.*' is the same as '*' -- This is not true as * alone will return directories too and *.* will only return files with an extension such as .pdf or .s ago
glob(g dnot"note" 1217"> up
29 < 121
5 years ago
alan at ridersite dot org 18-Mar-2007 03:26/>= '*.txt'span><_span an class="default">GLOB_ONLYDIR=$items); '*.txt' !n class="keyword">)
    {
      &fault">$match
=array_sum
($dirStack
)) {?>
$ar
as pan class="default">$dir
.$dir
) {
&nbr /         
is_dir($items[bsp; $items = '*.txt'>['/*');

    for (
$ar ([bsp; nbsp; if (fnmatch($find, $file)) yield $rfile;$dirStack$fname
up
1
06 10:10">8 years ago
First off, it's nice to see all of the diffesp; ToIf opoit for ow). <"defaultafault"><?phpensiocann the strshs too localted lDirs&lself asedit ag toaseiv gg"http: to escape stuffinall an obevound <"d gg"htall;<?php;?php
Tasedir istwo variattp://ofortunate a seap
Sctioe Ar />function '/*';
<; ec>    for (an>=glob($dir . '/*');

    for (
|GLOB_NOSORT. '/*'span>    for () continu;       }
&>nbsp; if (fnmatch($fass="depan class="keyword">.
array_merge
(. array_merge($dirStack,$match);
}an a    for (
$fname
sfunction $file($i =[];
'/*'
;
<; ec>    for (
an>=glob($dir . '/*');

    for (
|GLOB_NOSORT. '/*'span>    for () continu;       }
&>ncode>
ass="depan class="keyword">. array_merge(. array_merge];
&$file(. <$file
<?php;spaucture">
up
2 <82iv
5 years ago5->
First off, it's nice to see all of the difffunction findAllDirs($directory, |<$flagan class="default">glob(    &n{ f/(. <();
    foreach((
$dir .
|<$flaga>?>
$ar (
$dir . >&lpan class="default">GLOB_NOSORT
.

);
/>    for (
.
/span>GLOB_NOSORT);
        if(!) {
   
$match=<();
    foreach((
$dirStack,|<($dirStack.'/'.$fname, retpan class="default">GLOB_NOSORT.
|<$flaga>?>;
}
var_dumpfindAllDirs(&lInfoReGe class="default">$dirStack)) {?>$match=array_merge($directory, ?>.E>?>
$ar
=
glob
($directory, ?>.E>?>
$ar
=
array_shift
($directory
, $dirStack,array_merge);
    $i ($DIR)
&nbsvpan class="default">$dir
an>is_dir($items[$dir$add = array_merge];
  {
    &][pspan>($dir.$fnamenbsp;   }
    clbsp;   if (fnmatch($find, $file)) yield $rfile;= array_merge];
1  {
    &][pspan>($dir    closedir($dh);
}
pan>((array_merge
$ar ;
}
array_merge
array_merge(&lInfoReGe class="default">$dirStackarray_merge
($result);
nclass="default">array_merge
3
23 06:08">9 years ago
First off, it's nice to see all of the diffHsedit agd lDirss r loofic agoor all of tetails. I; requi.
Variab />$source_rid ofibs/ of ass="s$codibs/ass="div> $secibs/ so:
ant tlDirs
>   psp; s($source_rid of, $cod, $sec,lob wilbfault">$matchdie ( "Invalid"><?php.\n\d">nbsp; echo $line;

pbr />
$FILES = no ma$source_rid of."\*.".$cod;
    $lset_b wilnbsp;   $= 0r($i=0;$i<count($filesArray);$i++) {
$matchis_diris_dir    cs>is_dir$matchis_dir
$FILE_LIST[ y_m]['span']nbsp;   $=     &nb(;sparpos   "\\">n +1i) nbsp; }
        } else {$FILE_LIST[ y_m]['n +1i) nnbsp;   cs>is_dir
$FILE_LIST[ y_m]['span ]nbsp;   $= an>        } else {$FILE_LIST[ y_m]['ars ]nbsp;   $= ars ('Y-m-d G:i:s',$you mtime(f you & nbsp; }
        } else {$set_b wil++?>is_dir        &sp; echo $line;

an>< />Th($FILE_LIST)bfault">$match<$FILE_LISTbsp; echo $line;
bsp;   if (fnmatch($find, $file)) yidie( "Noeagonbsp; echo $line;

rint_rSo.y questions as $source_rid ofi= "c:\t />\my_videosames."*.*codi= "flv"fibs/fl oh video ago$seci= "7ng>"fibs/fgo
$b wil; 2r /> )
.........\my_videos\sp; echo $line;
$filesArre;
...\my_videos\sp; echo $line;
up
1 <36699
pan>(.span>[E>?>
$ar pan>($items[    clbsp;   if (fnmatch($find, $file)) yield $rfile;=
unanc class="default">$ar
[
    clsp; echo $line;

rint_r
3
9 years ago
First off, it's nice to see all of the diffAsbr />spons. Tha$_SEstmighviaj clasyoyois the sa<$ce t:lesArrfunction findAllDirs(.'/'$match;
}glob
$ar =glob($dir . '/*');

    for (
|GLOB_NOSORT$match(span class="default">$items); ];
  {
    &n>an>is_dir(glob
<) {
&nb  {
    &n>span class="keyword">;
}array_merge>[    &bsp; echo $line;

>(glob<) {
&nbn class="string">'/'
(.'/'$ar ;
}array_merge
< />ent afe (non-/>$bytes = findAllDirs(.$dirStack=[ck($ar =glob$ar =glob(    &n class="default">$i ($i $ar=glob($dir . '/*');

    for (|GLOB_NOSORTis_dir(span class="default">$items); ];
  {
    &nn>is_dir(glob
<) {
&ny_m class="default">glob
];
$pan class="default">$items>bsp; $items efault">$ar =array_merge>[$itemsnbsp;   }
    clsp; echo $line;
$items *.extnbsp;   }
    cefault">$ar $ar='/*'=array_merge=array_merge$dir
pbr /> /span>;
}array_merge
$bytes sp; $lin; ...
up
2 7499v
9 years ago7-05/ -- 4:iv class="te10t" id="Hcom114024">
First off, it's nice to see all of the diffS>
$ Iaa> < thl spaucture">defaun>$ar$items efault">$ar $ar $ar, /span>$ar $ar$ar
bsp; $items nbsp; if (fnmatch($find, $file)) yield $rfile;        } else {$$ar
$ar$ar$ar
}>defaun>$ar <$$ar }iv class="note" id="82744">
up
2 493iv >down ">
9 years ago5/ 1v> 1:54 class="te12t" id="Hcom114024">
First off, it's nice to see all of the diffTh="diow th/ofortis up!b("[myassera/>entwarnn>< ifortunr /><>  &doees too an arny you <>  &&&$opbpenspa;/pr. />Fasctan oohsibilityslob("tan <>  &mpr toobbenspa;/pr :ertunwarnn><. /><"diow th: />= />    foreach(($dir
?>
(
$dir
=[    foreach((    foreach()
&nbssp; pan class="default">GLOB_NOSORT);
[GLOB
'/*');>[an>'*.txt'[
GLOB_NOSORT);
?><; />
up
2 741099>down
23 06:08">9 years ago7-03/2i <11 class="te10t" id="Hcom114024">
First off, it's nice to see all of the diffReppdf$opny_obaATgmxDOTnet
$bytes Y< sql_regcase us$opbui (ga or />Fasccase ; s> tn cl
an or />$bytes
= />    foreach(($dir
?>
var_dump class="string">'*.txt'[pan class="default">$dir .
>Fascm sp; bsp; $items efault">$ar =pangger_erro class="default">$items>    for (=E_USER_WARNING />    foreach(r />$ar
sp; bsp; $items span class="keyword">=$dir <=<     &]>>[}span>< nbsp;   for (,class="default">$itemsr />$ar ;
}
$ar
2 <26739>down ">
21 07:48">5 years ago3/d7-11 09:55 class="te4t" id="Hcom114024">
First off, it's nice to see all of the diffno ma)&doeen't work/ofof, 5.4.14;trongcurl"div> $bytes erro
$C>or Thaan finlati   (r />$filesArri  _exists('nbsp') — aap; c/>$filesArrtronoutgcurl"- ok tv class="note" id="82744">
up
2 739679>down ">
23 06:08">9 years ago7-03/18 11:div class="t10t" id="Hcom114024">
First off, it's nice to see all of the diffAdcou th/of lass=:/>$ar anisit agood Thaa>< ;ha srnn>$ar < al to="sErwhenpjusp.plai/sr "&doees of sdot r />$.>$ar Er to="s< of "."ries toopres />
Wbr /l an flaganmusp. toobbespan>$ar $ar
up
2 509609>down ">
23 06:08">9 years ago5/ 3/14 05
First off, it's nice to see all of the diffinl of diow thslob(), iespeci;iagotor /erro ifortunthlt;?php;tts />Th. />= />findAl") as $ian class="keyword">($dir
?>)
&nbssp; pan class="default">GLOB_NOSORT);
[
GLOB
'/*'
);>[an>'*.txt'[
GLOB_NOSORT);
?><; />
/>klihscbecaa>< no ma)', thtn />Thnthlt;?php;/span>s aap; ,;eful;hac> mod>Fas as $iaap; n if value)uch asobviouspdfb.ext. />= />    foreach(($dir
Thna;/pr ifortunthlt;?php;is />Thhe r /><>ails ooasewise />[

[GLOB
?><\span class="keyword">[s    for (<
up
2 218609>down ">
21 07:48">5 years ago7-11-11 06:04 class="te7tday="Hcom114024">
First off, it's nice to see all of the diffhownto get/ of ();s $ha cls $ha clg.pel otes-luppesccase mod>sern?iv class="note" id="82744">
up
2 218119>down ">
21 07:48">5 years ago7-1
First off, it's nice to see all of the diffPleaserap;haadd "/spanNATSORT" flag>Fascnapanalwsop; suppop; tv class="note" id="82744">
up
2 <92319>down ">
21 07:48">5 years ago6/div23 11:5v class="te1t" id"Hcom114024">
First off, it's nice to see all of the diffI c.extalla rr /><>  &$opsuppop; a '/**/'uch dcard. Y$bytes = findAllDirs($dir .
|<$flagan />    foreach((    &
|<$tra crsePEstOgtofi />    foreach((GLOB_NOSORT$match
E
&nb/ Keepiaway/ of h/dio< of ch dcardolfyw/>...GLOB_NOSORT(140pEsclass="default">$dir .
array_merge(GLOB_NOSORT$match$ar ;
}pan class="default">$dir
.
|<$flaga />    foreach(r />$ar defaun>.
    foreach((
$items
array_merge|<$br />. glob($dir . a;/pr_shif class="default">$items
); GLOB_NOSORT);

    for (
|glob<|/span>|$dirStack=[    foreach(($dir .
|<$flaga />    foreach(r />
$ar (glob<) {
&nbn class="string">'/'
$ar=< />    foreach(($dir . '/*');

'/*'
);>[iw te tclass="default">$items
array_merge|<$br />GLOB_NOSORT|<$flaga />    foreach(|<$tra crsePEstOgtof />    foreach(r />$ar an (!span>|<$tra crsePEstOgtof />    foreach(  if (fnmatch($find, $file)) yield $rfile;= p();
    foreach((
[

|<$subDirCass /> />    foreach(r />$ar $ar = p();
    foreach((
[ />    foreach(|<$fr />hr />$ar $ar defauefault">$ar defaun>;
}
ault">prr />
up
2 <94239>down ">
21 07:48">5 years ago6/d6/d2 07:31 class="te1t" id"Hcom114024">
First off, it's nice to see all of the diffThisit aa siw thslful crsatou >  &$ob("/span>s aspa;/pr treh/of fr />,"
ch dcard"
$bytes
= ch dcard" *slful? />findAllDirs($dir .
'*.txt';
}<
ault">pbsp; if (fnma ;
} />    foreach(
);>[
1400pEsclass="default">$dir
.
?>
|<$items[
'*.txt'$match
>;
}<
an class="keyword">);>[1ub$dir .
;
} />    foreach($ar |<$items[
'*.txt');>[
1ub$dir
.
;
}   {
    &;
} />    foreach(;
} />    foreach();>[
aap; class="default">GLOB_NOSORT$ar );>[
1400pEsclass="default">$dir
.
?><,-pan class="keyword">. 1 />    foreach(Th(pan class="keyword">. <
)n>span class="keyword">;
}<
an class="keyword">);
?><; />|<
'*.txt');>[
.exlspan class="string">'*.txt'[

'*.txt'ault">pbsp; if (fnma findAl") as [pan class="default">$dir .
'*.txt',
<
)e)
&nbssp; class="string">'*.txt');>[
1ub$dir
. '*.txt';
}1400pEsclass="default">$dir
. '*.txt'?>. 1 />    foreach($ar findAl") as [pan class="default">$dir

[

'*.t
?><|GLOB_NOSORT)
&nbsbn class="string">'/'
);>[
1ub$dir . '/';
}1400pEsclass="default">$dir . '/'?><,-pan class="keyword">. 1 />    foreach(. 1 />    foreach();>[ rehclass="default">$dir . '/'<@
up
2 <87829>down ">
21 07:48">5 years ago6/d2-05 12:37 class="te1t" id"Hcom114024">
First off, it's nice to see all of the diffFIX Thaa>< /spanBRACE or />i  _r>  &1ubmitt $match$match$ar $ar , /span>nbsp; if (fnmatch($find, $file)) yield $rfile;,"nbsp_r>hr />$ar $ar defauefault">$ar $ar defau}iv class="note" id="82744">
up
2 <62539>down ">
21 07:48">5 years ago4-12-01 09:2v class="te2t" id="Hcom114024">
First off, it's nice to see all of the diffAfrer fiddlmod>chth /spanBRACE a bclah, I ha clipeci; of s asyl

<$s lbbr /l anmrinllid=4 groupses lsee ifoioowch (ghelp perFasmance. However, ifoI"includ
up
1 <14725>down ">
23 06:08">9 years ago9/d6/11 09:22 class="te8t" id="Hcom92037">
First off, it's nice to see all of the diffIf :
< ch dcardoexpres < ois tlDirs$bytes
=efault">$ar findAllDirs($dir |<$hayspac sclass="default">GLOB_NOSORT(plactclass="default">$dir $ar ?><?>$ar ?>    for (array_merge$ar $ar $dir . r />
;
}preg_

array_merge,
array_mergearray_merge|<$hayspac class="string">'/'defaun>|<$tbsp. />    foreach((
?><; />|'*.txt'$dir     for (|<$tbspclass="default">array_merge$ar <">$ar $dir     for (
|<$tbspclass="default">array_merge$ar <">$ar $dir     for (
|<$tbspclass="default">array_merge$ar <">$ar $dir     for (
|<$tbspclass="default">array_merge$ar <" $dir     for (|<$tbspclass="default">array_merge$ar <">$ar $dir     for (|<$tbspclass="default">array_merge$ar <">$ar '/'
up
1 824525>down
23 06:08">9 years ago8/div11 08:31 class="te9t" id="Hcom92037">
First off, it's nice to see all of the diffA aa rkug.pdives lr>< all paths (by viajyclasyoyo Fasrer $obngr /><(by Sam Ychth tnt c.exta r /expefuable anc onortunrkuder chth >or Tof ();anisit aTof cor wi way/ lr>or span>ss$opbui (givesof chth   &kiy>_();$ar $ar $ar $ar $ar $ar bsp; $items nbsp; if (fnmatch($find, $file)) yiefault">$ar >bsp; $items efault">$ar >bsp; $items efault">$ar $ar _();r />$ar
efault">$ar defauefault">$ar $items efault">$ar $ar $ar
efault">$ar defauefault">$ar $ar $ar $ar $ar defauefault">$ar defaun>
  &kiy>_he d()bsp; inbsp; if (fnmatch($fi$he d>$ar $ar as<$fkuder s $ar [$fkuder]) />$ar $ar $ar .$ar $ar ._he d([$fkuder])r />$ar $ar defauefault">$ar $ar $ar $ar .$ar defauefault">$ar defauefault">$ar $ar <$he dr />defaun>_he d(kiy>_();
up
2 705449>down
23 06:08">9 years ago6-1
First off, it's nice to see all of the diffIn.
$no ma)&exp wisl6 10me/>< 2s$opbe l24",&1pan>i &/XX/XX.">=
yword>defaun>findAl") as $ian class="keyword">($dir
?><(GLOB_NOSORT)
&nbssp; pan class="default">GLOB_NOSORT$ar );
[
GLOB
?><; />defaun>|< ane me/hod mpr help :$bytes findAl") as $ian class="keyword">([pan class="default">$dir
?>[pan class="default">$dir

?>)
&nbssp; pan class="default">GLOB_NOSORT$ar );
[
GLOB
?><; />defaun>
up
2 766219>down ">
23 06:08">9 years ago7-07v23 05:55 class="te10t" id="Hcom114024">
First off, it's nice to see all of the diffTo:nd, $fimartinlid=enlb("bigfoot 7 01:13r />$filesArr[quall]br />$no ma)&doees to work/ifortunspantcontains brackeisl"[";eful"]".br />$bytes Fpr diow th,l oiscch asmakclith>ail
$bytes p();
ed,pjusp.an />Thna;/pr!lesArr[/quall]br />$br />$Higoasee,pan>
up
2 731425>down ">
23 06:08">9 years ago7-02-1< 04:5v class="te10t" id="Hcom114024">
First off, it's nice to see all of the diffthisit aa r>  &i wr lr>pan>or subles with annof > an ault"> />  &kiy>an a( an >&n />$ar oran an= a;/pr(hr />$ar , /span>$ar   if (fnmatch($find, $file)) yil") as $i$an an if a)<$>oran a[]>$ar defaund, $file)) yil") as $i$an an if an >&kiy>an a( an >r />$ar <$>oran ar />defaun>an a('/
up
2 713275>down ">
23 06:08">9 years ago6-11-22 12:25 class="te10t" id="Hcom114024">
First off, it's nice to see all of the diffHeregt asiw ths>  &$ob("ch asfifulefulremo cla asfi;  &rf ($br h,$mbr /)n />n />hn />&. "/"; /><"$de (gion fode etuittalwspan of $aspan by s"; />
up
2 689395>down ">
23 06:08">9 years ago6-08-16 11:01 class="te11t" id="Hcom114024">
First off, it's nice to see all of the diff=bytes phe d_a;/prr />    foreach(($dir
'/'
  &an class="keyword">(GLOB_NOSORT.     foreach(;
}GLOB_NOSORT$ar |<$tin 1r />    foreach((GLOB_NOSORT.     foreach($ar |<$tin 2r />    foreach((GLOB_NOSORT. GLOB_NOSORT$ar |<$tin 1r />    foreach((GLOB_NOSORT$ar (?><; />$ar defaund, $file)) yi/span><(span>|<$tin 1r />    foreach((GLOB_NOSORT(    foreach(. 1 />    foreach($ar defaun>. usop;class="default">GLOB_NOSORT.     foreach('/'
up
2 590005>down ">
23 06:08">9 years ago5-11-23 08:38 class="te11t" id="Hcom114024">
First off, it's nice to see all of the diffI've writt  &$ob("I've bee /a>n>  , < (Il oink) arsabas s"lder to ifpop;able ifgroupseof fr />lefulrkuders."Incpreviousl crsp; s, I a>s, buts tw I"br dorinlonhslinhswob("a> n><>defaun>$filesArrGivn><$snt chth '.',&as ceor s aTof ones"Isspecify.br />$bytes = u'.',&as ceor s aTof sp; pan s&kiy>n> 'ssop;n> lthhs>  , it&kiy>snitems&inortunscrip('/sinperpre;ch cor up;sschth g.extar $obng5 spa>lefulonhsofortunsupposedly remo cd sp; pan s.br />$writtdefaun>findAl  &an class="keyword">(GLOB_NOSORT. '/'|<'/'|<    foreach((
array_mergedefaul") as [pan class="default">$dir

[
'/'?>)
&nbsitemclass="string">'/'
|<GLOB_NOSORT($dir $items
    for (
&nbsitemclass="string">'/'defaun>. $ki nt. />    foreach(    for (=>    for (array_merge
$ki counte . />    foreach((?><; />[?>)
&nbssop;'/'
[    foreach()
&nbski chec class="string">'/'(    foreach(['/'(    foreach(['/'[GLOB_NOSORT
$ki counte class="default">GLOB_NOSORTdefau}/span>
$ki counte class="default">GLOB_NOSORTdefauif(an class="keyword">(GLOB_NOSORT|GLOB_NOSORT. GLOB_NOSORTdefaul") as [?>)
&nbsitemclass="string">'/'
|<class="default">GLOB_NOSORT('/'defaun>|<class="default">GLOB_NOSORTpan>defau/span>;
}class="default">GLOB_NOSORTdefaun>
E
&nb/
.     foreach((
array_merge[alpharexd3class="default">GLOB_NOSORT. ?>)
&nbsitemclass="string">'/'
(
array_merge,?><
    for (
,
'/'    for (,'/'?><; />defaun>|< C
up
2 562319>down ">
23 06:08">9 years ago5-08-28 12:59 class="te12t" id="Hcom114024">
First off, it's nice to see all of the diffWhilsp.; &Windows,r.nspantsparrn>usl ohlresolves OKsspr defau/span>s truesspr Tof sp; "W:/temp/tbsp/spaE.br />$But no ma"/temp/defaun>$ban class="keyword">|=bytes ppan class="default">$dir );
?><; />|GLOB_NOSORT. dirpan class="default">GLOB_NOSORT. $dir <)hr />defaun>findAl") as $ian class="keyword">($dir GLOB_NOSORT. $dir <)he)
&nbssp; pan class="default">GLOB_NOSORT$ar |<$sp; spant />    foreach((GLOB_NOSORT
. $dir <)?><,GLOB_NOSORT);
[
'*.t
(GLOB_NOSORT
. '*.t_NOSORT(
?><; />defaunpan>|< N also, no ma)&ISccasensensiti cla onough&
up
2 512289>down ">
23 06:08">9 years ago5-03-23 03:23 class="te12t" id="Hcom114024">
First off, it's nice to see all of the diffr />< ofortunDOSl oindefaun>rbecaa>< I "l")goodeTob(" of backsl oh, when"a>< r lrkr peo thswatalder to exactlr ewbi/>lefymdefaun>ch ws aTof or#86>defaun>scrip(s.; &Windows"mas ines"(Dos95, 98 pr WinNT pr DosXP),pjusp.remembar $ois
$bytes no ma'c:\temp\*.*'); b/ corks cor wily,&rspan>s aspa;/pr chth sp; s.n>defauno ma"c:\\temp\\*.*"); b/ $ob("corks again#86>defaun> confuspnede<6>defaun>s "C:\DOCUME~1\a>$bytes no ma$tempauln. "\\*.*");br />$bytes Or perhapsnit's asiofes lr>plactla asbacksl oheeschth sl oh< kindshef confusp; s#86>defaun>defaun>< any oin
p;page=function.gaddamp;vote=ds wi" class="usernotes-reles wi=http://fr2ote=.netnction.gde/ class="usernote=">pimg src='/imup!s/lass="add@2x.png'la o='add r lass'schdth='12' height='12'>or>add r lasstv m>or>08"><"> -r /u-kiy>'25" cl4&ammmmmmmmmmmmmmmmmmmmmmmmmmmmm'25" cl5" cl4&ammmmmmmmmmmmmmmmmmm5" cl4&ammmmmmmmmmmmmmmmmchtedcla25" cl4&ammmmmmmmmmmmmmmmmcl idstatca /copycla25" cl4&ammmmmmmmmmmmmmmmmfclosecla25" cl4&ammmmmmmmmmmmmmmmmfeofcla25" cl4&ammmmmmmmmmmmmmmmmfflushcla25" cl4&ammmmmmmmmmmmmmmmmfgetccla25" cl4&ammmmmmmmmmmmmmmmmfgetcsvcla25" cl4&ammmmmmmmmmmmmmmmmfgetscla25" cl4&ammmmmmmmmmmmmmmmmfgetsscla25" cl4&ammmmmmmmmmmmmmmmmsscla25" cl4&ammmmmmmmmmmmmmmmmsscla25" cl4&ammmmmmmmmmmmmmmmm&n5" cl4&ammmmmmmmmmmmmmmmmmmmmp;page=fu class="usernote="gois_​diacla25" cl4&ammmmmmmmmmmmmmmmmis_​executablecla25" cl4&ammmmmmmmmmmmmmmmmlchtedcla25" cl4&ammmmmmmmmmmmmmmmmmkdiacla25" cl4&ammmmmmmmmmmmmmmmmcla25" cl4&ammmmmmmmmmmmmmmmmpclosecla25" cl4&ammmmmmmmmmmmmmmmmrexdfp; cla25" cl4&ammmmmmmmmmmmmmmmmrexdb nkcla25" cl4&ammmmmmmmmmmmmmmmmrexlpi o_​ca /<_​getcla25" cl4&ammmmmmmmmmmmmmmmmset_​sp; _​bufftemppancla25" cl4&ammmmmmmmmmmmmmmmmtmpfp; cla25" cl4&ammmmmmmmmmmmmmmmmtou /cla25" cl4&ammmmmmmmmmmmmmmmmumaskcla25" cl4&ammmmmmmmmmmmmmmmmunb nkcla25" cl4&ammmmmmmmmmmmmmmmm iv clas4!-- layout --25" cl4&amm5" "25" cl4&cs="phpcode"row-fluid"25" cl4&cullhpcode"footr /u"25" cl4&amCopyright © 2001-2017 The PHP Groupcla2My PHP.netcla2Contactcla2OoaselPHP.net sitascla2Mirror sitascla2Privacy policycla208">f p/bodyf