|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
GlobFileSuffix_ToExp_NoCase() - Create a 2-letter case-insensitive file suffix glob array for use inThis function is part of a solution when you want to use the PHP glob() function to return a list of files with a certain suffix, but you want the glob to perform matching in a case-insensitive manner. Originally, I wrote this function, ... and ... on Linux, this works fine, but on Windows, the glob() function (using the GLOB_BRACE flag) will not handle this correctly (see PHP bug 69628). As a result, we have to take a new approach using this function. Please read the info on that page for more info.
function GlobFileSuffix_ToExp_NoCase ($Suffix) {
$r = ''; $i = 0;
for ($i; $i < strlen($Suffix); $i++) {
$char = substr($Suffix, $i, 1);
$r .= '[' . strtolower($char) . strtoupper($char) . ']';
}
return $r;
}
|
|
|
|
Entire Thread
|
GlobFileSuffix_ToExp_NoCase() - Create a 2-letter case-insensitive file suffix glob array for use in
|
Russ
|
05/14/15 05:31 PM
|
|
|
|