this is my first foray into PHP file stuff… (but I think it’s actually a string-parsing prob, not a file problem…)
inside a dir., I need to find all files that are a dir…
so going from example here,
I did:
if (is_dir($dirPgs)) {
if ($dh = opendir($dirPgs)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dirPgs . $file) . "<br>";
// but prob here is it also pulls in parent dir and g'parent dir (weird...)
// so: what I need is all dirs, and they're all named "page1", "page2", etc..
// so I thought I'd just check for occurrence of string "page" in file name..
// and ran into a heap of trouble.. as this
if ( strpos($file, 'page') == true) echo 'this is a page dir';
// is not doing what I expect it to.... it's not printing anything...
// there are six dirs, from "page1" to "page6" in this particular instance..
// so why is my 'echo' stmt here not printing?
// weird thing is, if I do
if ( strpos($file, 'age') == true) echo 'this is a page dir';
// then 'echo' stmt prints... WHY ON EARTH IS THIS??
}
closedir($dh);
}
}
this is just bizarre… I have checked file-names like this with Java a lot, with the IndexOf() string method, always works as expected… I just don’t get what’s happening here… what am I missing…
thank you…