public static function sanitize($string, $mask)
	{
		//check if the input mask is an array
		if( is_array($mask))
		{
			//assign value to parts
			$parts = $mask;

		}

		//check if $mask is a string
		else if( is_string($mask))
		{
			//divide string into substrings
			$parts = str_split($mask);

		} 

		//not any of the above, return the string 
		else
		{
			//return string
			return $string;

		}
		
		//loop through the parts array normalizing each part
		foreach ($parts as $part) 
		{
			//normalize the part
			$normalized = self::normalize("\\{$part}");

			//search string and replace normalized string in place of original string from input $string
			$string = preg_replace("{$normalized}m", "\\{$part}", $string);

		}

		//return the string after sanitizing is complete
		return $string;

	}
public static function sanitize($string, $mask)
	{
		//check if the input mask is an array
		if( is_array($mask))
		{
			//assign value to parts
			$parts = $mask;

		}

		//check if $mask is a string
		else if( is_string($mask))
		{
			//divide string into substrings
			$parts = str_split($mask);

		} 

		//not any of the above, return the string 
		else
		{
			//return string
			return $string;

		}
		
		//loop through the parts array normalizing each part
		foreach ($parts as $part) 
		{
			//normalize the part
			$normalized = self::normalize("\\{$part}");

			//search string and replace normalized string in place of original string from input $string
			$string = preg_replace("{$normalized}m", "\\{$part}", $string);

		}

		//return the string after sanitizing is complete
		return $string;

	}
public static function sanitize ( $ string , $ mask ) { //check if the input mask is an array if ( is_array ( $ mask ) ) { //assign value to parts $ parts = $ mask ; } //check if $mask is a string else if ( is_string ( $ mask ) ) { //divide string into substrings $ parts = str_split ( $ mask ) ; } //not any of the above, return the string  else { //return string return $ string ; } //loop through the parts array normalizing each part foreach ( $ parts as $ part ) { //normalize the part $ normalized = self :: normalize ( "\\{$part}" ) ; //search string and replace normalized string in place of original string from input $string $ string = preg_replace ( "{$normalized}m" , "\\{$part}" , $ string ) ; } //return the string after sanitizing is complete return $ string ; }
This method loops through the characters of a string, replacing them with regualar expression friendly
character representations.

@param string $string The string to be converted
@param string $mask
@return string The string after it has been sanitized
This method loops through the characters of a string replacing them with regualar expression friendly character representations .