Forum Moderators: coopster
Returns an array containing the matched files/directories, an empty array if no file matched or FALSE on error.
PHP Glob [us2.php.net]
You're essentially getting $imgcount[0]=""; which results in a count of 1.
I'd probably use a conditional:
$countImages=glob("$imagebdir*.jpg");
if(count($countImages)>1 ¦¦ !empty($countImages[0])) {
$imgcount=count($countImages);
}
else {
$imgcount=0;
}
* Make sure to change the broken-bar characters to standard bar characters if copying and pasting.
I had read that item in the manual but didn't understand how to deal with it.
Strangely, I had searched on the web for "counting files with php" and had found several references to using the glob method with that one line of code but no one dealt with the problem of the false 1.
Thank you again