Glob

The glob: stream wrapper is available since PHP 5.3.0.

Пример #1 Basic usage

<?php
// Loop over all *.php files in ext/spl/examples/ directory
// and print the filename and its size
$it = new DirectoryIterator("glob://ext/spl/examples/*.php");
foreach(
$it as $f) {
    
printf("%s: %.1FK\n"$f->getFilename(), $f->getSize()/1024);
}
?>
tree.php: 1.0K
findregex.php: 0.6K
findfile.php: 0.7K
dba_dump.php: 0.9K
nocvsdir.php: 1.1K
phar_from_dir.php: 1.0K
ini_groups.php: 0.9K
directorytree.php: 0.9K
dba_array.php: 1.1K
class_tree.php: 1.8K

Wrapper Summary
Attribute Supported
Restricted by allow_url_fopen No
Restricted by allow_url_include No
Allows Reading No
Allows Writing No
Allows Appending No
Allows Simultaneous Reading and Writing No
Supports stat() No
Supports unlink() No
Supports rename() No
Supports mkdir() No
Supports rmdir() No

Коментарии

Автор:
// this is an example for Darwin (iOS) file system 

<?php
    $it
=new DirectoryIterator("glob:///Users/hybrid/projects/backupfiles/*.py");

print(
"\nHere's is the example for memory occupied in kilobytes"."\n\n");
foreach(
$it as $f) {

// output in kilobytes
   
printf("%s: %.1FK\n"$f->getFilename(), $f->getSize()/1024);   
}

print(
"\nHere's is the example for memory occupied in bytes"."\n\n");
foreach(
$it as $f) {

// output in kilobytes
     
printf("%s: %.1FK\n"$f->getFilename(), $f->getSize());
}

?>
2024-03-22 18:53:47
http://php5.kiev.ua/manual/ru/wrappers.glob.html
Автор:
// this is an example for Darwin (iOS) file system 

<?php
    $it
=new DirectoryIterator("glob:///Users/hybrid/projects/backupfiles/*.py");

print(
"\nHere's is the example for memory occupied in kilobytes"."\n\n");
foreach(
$it as $f) {

// output in kilobytes
   
printf("%s: %.1FK\n"$f->getFilename(), $f->getSize()/1024);   
}

print(
"\nHere's is the example for memory occupied in bytes"."\n\n");
foreach(
$it as $f) {

// output in kilobytes
     
printf("%s: %.1FK\n"$f->getFilename(), $f->getSize());
}

?>
2024-03-22 18:54:46
http://php5.kiev.ua/manual/ru/wrappers.glob.html

    Поддержать сайт на родительском проекте КГБ