StrArr_ToGlobExpr_NoCase() - Used to create a no-case glob expression from a list of file suffixes

This can be used with the other "glob no-case" functions (Str_Glob_NoCase() and StrArr_Glob_NoCase())to help create a complete solution.


PHP Code

function StrArr_ToGlobExpr_NoCase ($Suffixes) {
	/*
	Purpose
		Used to create a no-case glob expression from a list of file suffixes.
	Parameters
		Suffixes (string array) = List of file suffixes to be used in the resulting expression.
	Return (string)
		Returns a no-case glob expression from the specified list of file suffixes.
		Example: Suffixes = [jpg][JPG]
			Returns: "[jpg],[JPG]"
	Version History
		1.0 2015.05.13	Tested by Russ Tanner on PHP 5.6.8 Win 7-64.
	*/

	$r = '';

	// Concatenate all suffixes to a glob expression.
	for ($i = 0; $i < count($Suffixes); $i++) {
		$r .= '[' . $Suffixes[$i] . '],';
	}

	// Remove the final trailing comma.
	$r = rtrim($r, ',');

	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)