english/libraries/joomla/utilities/string.php
/**
	 * UTF-8/LOCALE aware alternative to strcasecmp
	 * A case insensivite string comparison
	 *
	 * @param   string  $str1    string 1 to compare
	 * @param   string  $str2    string 2 to compare
	 * @param   mixed   $locale  The locale used by strcoll or false to use classical comparison
	 *
	 * @return  integer   < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
	 *
	 * @see     http://www.php.net/strcasecmp
	 * @see     http://www.php.net/strcoll
	 * @see     http://www.php.net/setlocale
	 * @since   11.1
	 */
UTF-8/LOCALE aware alternative to strcasecmp
A case insensivite string comparison

@param   string  $str1    string 1 to compare
@param   string  $str2    string 2 to compare
@param   mixed   $locale  The locale used by strcoll or false to use classical comparison

@return  integer   < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.


UTF - 8 / LOCALE aware alternative to strcasecmp A case insensivite string comparison @param string $str1 string 1 to compare @param string $str2 string 2 to compare @param mixed $locale The locale used by strcoll or false to use classical comparison @return integer < 0 if str1 is less than str2 ; > 0 if str1 is greater than str2 and 0 if they are equal .
public static function strcasecmp($str1, $str2, $locale = false)
	{
		if ($locale)
		{
			$locale0 = setlocale(LC_COLLATE, 0);
			if (!$locale = setlocale(LC_COLLATE, $locale)) {
				$locale = $locale0;
			}
			if(!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m)) {
				$encoding = 'CP' . $m[1];
			}
			else if(stristr($locale, 'UTF-8')){
				$encoding = 'UTF-8';
			}
			else {
				$encoding = 'nonrecodable';
			}
			if ($encoding == 'UTF-8' || $encoding == 'nonrecodable') {
				return strcoll(utf8_strtolower($str1), utf8_strtolower($str2));
			} else {
				return strcoll(self::transcode(utf8_strtolower($str1),'UTF-8', $encoding), self::transcode(utf8_strtolower($str2),'UTF-8', $encoding));
			}
		}
		else
		{
			return utf8_strcasecmp($str1, $str2);
		}
	}
public static function strcasecmp ( $ str1 , $ str2 , $ locale = false ) { if ( $ locale ) { $ locale0 = setlocale ( LC_COLLATE , 0 ) ; if ( ! $ locale = setlocale ( LC_COLLATE , $ locale ) ) { $ locale = $ locale0 ; } if ( ! stristr ( $ locale , 'UTF-8' ) && stristr ( $ locale , '_' ) && preg_match ( '~\.(\d+)$~' , $ locale , $ m ) ) { $ encoding = 'CP' . $ m [ 1 ] ; } else if ( stristr ( $ locale , 'UTF-8' ) ) { $ encoding = 'UTF-8' ; } else { $ encoding = 'nonrecodable' ; } if ( $ encoding == 'UTF-8' || $ encoding == 'nonrecodable' ) { return strcoll ( utf8_strtolower ( $ str1 ) , utf8_strtolower ( $ str2 ) ) ; } else { return strcoll ( self :: transcode ( utf8_strtolower ( $ str1 ) , 'UTF-8' , $ encoding ) , self :: transcode ( utf8_strtolower ( $ str2 ) , 'UTF-8' , $ encoding ) ) ; } } else { return utf8_strcasecmp ( $ str1 , $ str2 ) ; } }
UTF-8/LOCALE aware alternative to strcasecmp
 A case insensivite string comparison
UTF - 8 / LOCALE aware alternative to strcasecmp A case insensivite string comparison
// Get current locale // See if we have successfully set locale to UTF-8 // if we sucesfuly set encoding it to utf-8 or encoding is sth weird don't recode