StrArr_Glob_NoCase() - create an array of case-insensitive glob subexpressions

Note the dependency Str_Glob_NoCase() this function has. Be sure to include the dependency in your project.

PHP Code

function StrArr_Glob_NoCase ($Suffixes) {
	/*
	Purpose
		Used to create an array of case-insensitive glob subexpressions from a specified list of file suffixes.
		The GLOB_BRACE glob() option does not work on Windows, so we have to take this approach.
	Parameters
		Suffixes (string array) = The list of file suffixes we are building an expression with.
	Return
		Example: [jpg],[png] returns:
			"[jpg],[jpG],[jPg],[jPG],[Jpg],[JpG],[JPg],[JPG],[png],[pnG],[pNg],[pNG],[Png],[PnG],[PNg],[PNG]"
		Returns a zero-length string if:
			- The specified suffix list (Suffixes) is empty.
	Version History
		1.0 2015.05.13	Tested by Russ Tanner on PHP 5.6.8 Win 7-64.
	*/

	$r = array();

	// Loop through all specified suffixes. Generate and concatenate each list of expressions.
	for ($i = 0; $i < count($Suffixes); $i++) {
		$r = array_merge($r, Str_Glob_NoCase($Suffixes[$i]));
	}

	return $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)