Tuesday, 19 November 2019

Glob pattern does not match anything

According to the PHP documentation, the pattern ... matches all subdirectories recursively, but when I try using it, no files are matched.

According to the documentation, glob hasn't changed since PHP 5.1, but if it matters, I am using PHP 7.2.24 .

Directory structure:

.
├── bar
│   └── bar_file
└── foo
    ├── 1
    │   └── foo_1_file
    └── foo_file

PHP:

var_dump(glob('./.../*')); // prints array(0) {}
var_dump(glob('./.../foo_file')); // prints array(0) {}

I know there is a workaround for this problem, but I would like to know if there is a PHP native solution or if there isn't, why the PHP reference documentation is defective.



from Glob pattern does not match anything

No comments:

Post a Comment