2561,
define('LOWERCASE',3);
define('UPPERCASE',1);
function detect_cyr_charset($str) {
$charsets = Array(
'k' => 0,
'w' => 0,
'd' => 0,
'i' => 0,
'm' => 0
);
for ( $i = 0, $length = strlen($str); $i < $length; $i++ ) {
$char = ord($str[$i]);
//non-russian characters
if ($char < 128 || $char > 256) continue;
//CP866
if (($char > 159 && $char < 176) || ($char > 223 && $char < 242))
$charsets['d']+=LOWERCASE;
if (($char > 127 && $char < 160)) $charsets['d']+=UPPERCASE;
//KOI8-R
if (($char > 191 && $char < 223)) $charsets['k']+=LOWERCASE;
if (($char > 222 && $char < 256)) $charsets['k']+=UPPERCASE;
Изменил: Lugaro (05.11.2009 / 17:05)