<?php
$text = "Пocтaвкa мяco гoвядины, Sаmsung, бecкостнoe для нужд государственного бюджетного учреждения здравоохранения Республики Башкортостан Инфекционная клиническая больница № 4 города Уфа " ;
$regexpRus = '/(?<!\\w)[а-я]+[a-z]+\\w*/ui' ;
$regexpLat = '/(?<!\\w)[a-z]+[а-я]+\\w*/ui' ;
function fixText( $text , $regexp ) {
'A' => 'А' , 'a' => 'а' , 'B' => 'В' , 'C' => 'С' , 'c' => 'с' , 'E' => 'Е' , 'e' => 'е' , 'K' => 'К' , 'M' => 'М' , 'O' => 'О' , 'o' => 'о' , 'P' => 'Р' , 'p' => 'р' , 'T' => 'Т' , 'y' => 'у' , 'X' => 'Х' , 'x' => 'х'
) ;
foreach ( $words [ 0 ] as $word ) {
if ( preg_match ( '/(?<!\\w)[а-я]+[a-z]+\\w*/ui' , $word ) ) { echo "Опечатка в слове {$word} : {$result} \n " ;
$fixRus = strtr ( $word , $letters ) ; echo "Опечатка в слове {$fixRus} исправлена.\n " ;
}
elseif ( preg_match ( '/(?<!\\w)[a-z]+[а-я]+\\w*/ui' , $text ) ) { echo "Опечатка в слове {$word} : {$result} \n " ;
$fixLat = strtr ( $word , $letters ) ; echo "Опечатка в слове {$fixLat} исправлена.\n " ;
}
} }
$resultRus = fixText( $text , $regexpRus ) ;
echo "{$resultRus} \n " ;
$resultLat = fixText( $text , $regexpLat ) ;
echo "{$resultLat} \n " ;
PD9waHAKIAplcnJvcl9yZXBvcnRpbmcoLTEpOwptYl9pbnRlcm5hbF9lbmNvZGluZygndXRmLTgnKTsKCiR0ZXh0ID0gItCfb2PRgmHQstC6YSDQvNGPY28g0LNv0LLRj9C00LjQvdGLLCBT0LBtc3VuZywg0LFlY9C60L7RgdGC0L1vZSDQtNC70Y8g0L3Rg9C20LQg0LPQvtGB0YPQtNCw0YDRgdGC0LLQtdC90L3QvtCz0L4g0LHRjtC00LbQtdGC0L3QvtCz0L4g0YPRh9GA0LXQttC00LXQvdC40Y8g0LfQtNGA0LDQstC+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