GlobFileSuffixList_ToExp_NoCase() - create a case-insensitive glob expression

This function can be used with the PHP glob() function to create a case-insensitive file search.

Note the dependency GlobFileSuffix_ToExp_NoCase().

PHP Code

function GlobFileSuffixList_ToExp_NoCase ($SuffixList) {
	/*
	Purpose
		Used to create a case-insensitive glob expression from a specified list of file suffixes.
	Parameters
		SuffixList (array) = A list of file suffixes we are building an expression with.
	Return
		Example: ["jpg","GIF] returns "[jJ][pP][gG],[gG][iI][fF]"
	Version History
		1.0 2014.09.06 Tested by Russ Tanner on PHP 5.3.10.
	*/

	$r = ''; // Return buffer.

	// Iterate the specified array of suffixes.
	foreach ($SuffixList as $Suffix) {
		$r .= GlobFileSuffix_ToExp_NoCase($Suffix) . ',';
	}

	// Remove the trailing comma and return the result.
	return rtrim($r, ',');

}
 


The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)