Re: [PHP] glob(path_pattern, GLOB_ONLYDIR)
- From: jochem@xxxxxxxxxxxxx (Jochem Maas)
- Date: Sun, 18 Mar 2007 19:44:13 +0100
Al wrote:
I thought the "." had meaning since the manual user notes used it
it means a literal dot, many people assume that glob expressions
use the same syntax as regular expressions but this is not the case.
Definitely, my php is version 4.4.4; it's on a virtual host.
I found the glob file for the GNU C Library and GLOB_ONLYDIR doesn't
seem to be defined correctly, the file appears to rather old.
I used the numerical value "8196" and it works fine. I'm a little
reluctant to use the numerical value as I want my code to be generally
universal. Maybe the numerical value is safer anyhow. What do you think?
you might consider something like this:
if (!defined('GLOB_ONLYDIR'))
define('GLOB_ONLYDIR', 8196);
I doubt that the numeric value will ever change btw.
I can alternatively just filter out the files in a second step.
that seems like a lesser solution.
.
Al.............
Jim Lucas wrote:
Al wrote:
I can't use flag "GLOB_ONLYDIR" to work on a Linux, php4.4.4. I onlyremember this is linux you are talking about, not windows.
want the dirs.
This works; sort of:
print_r(glob('../*',)); //It lists all the files AND directories.
Yet it seems to ignore the lack of ".*" and finds xxx.yyy. That's OK,
I can delete the files
A '*' means anything, including a '.'
well, double check your php version, because this should be built in
This fails:
print_r(glob('../*', GLOB_ONLYDIR));
whit the version that you are running.
And I get: "Warning: glob() expects parameter 2 to be long, string
given in foo"
I can't find anything in the manual or when Googling.
Anyone can explain this for me?
- Follow-Ups:
- References:
- glob(path_pattern, GLOB_ONLYDIR)
- From: Al
- Re: [PHP] glob(path_pattern, GLOB_ONLYDIR)
- From: Jim Lucas
- Re: [PHP] glob(path_pattern, GLOB_ONLYDIR)
- From: Al
- glob(path_pattern, GLOB_ONLYDIR)
- Prev by Date: Re: [PHP] glob(path_pattern, GLOB_ONLYDIR)
- Next by Date: Re: Preventing unwanted chars from outputting
- Previous by thread: Re: [PHP] glob(path_pattern, GLOB_ONLYDIR)
- Next by thread: Re: [PHP] glob(path_pattern, GLOB_ONLYDIR)
- Index(es):
Relevant Pages
|