Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
function BGtoEN($string)
{
$bg = Array("Щ","Ш","Щ","Ш","щ","ш","CH","Ch","ch","А","Б","Ц","Д","Е","Ф","Г","Х","И","Й","Ж","К","Л","М","Н","О","П","Я","Р","С","Т","Ъ","В","Л","Х","У","З","а","б","ц","д","е","ф","г","х","и","й","ж","к","л","м","н","о","п","я","р","с","т","ъ","в","л","х","у","з","ч","ш","х");
$en = Array("Sht","Sh","SHT","SH","sht","sh","Ч","Ч","ч","A","B","C","D","E","F","G","H","I","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","ch","sh","x");
for($i = 0; $i < count($en); $i++) $string = str_replace($bg,$en,$string);
return $string;
}
function ENtoBG($string)
{
$bg = Array("Щ","Ш","Щ","Ш","щ","ш","CH","Ch","ch","А","Б","Ц","Д","Е","Ф","Г","Х","И","Й","Ж","К","Л","М","Н","О","П","Я","Р","С","Т","Ъ","В","Л","Х","У","З","а","б","ц","д","е","ф","г","х","и","й","ж","к","л","м","н","о","п","я","р","с","т","ъ","в","л","х","у","з","ч","ш","х");
$en = Array("Sht","Sh","SHT","SH","sht","sh","Ч","Ч","ч","A","B","C","D","E","F","G","H","I","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","ch","sh","x");
for($i = 0; $i < count($en); $i++) $string = str_replace($en,$bg,$string);
return $string;
}
niker каза:Да ги реплейсна една върхо друга ли?
Смисал как ше разбера кирилица или латиница пише ?
deam0n каза:niker каза:Да ги реплейсна една върхо друга ли?
Смисал как ше разбера кирилица или латиница пише ?
С регуларен израз.
<?php
header('Content-Type: text/html; charset=utf-8');
$pattern = "/^[\p{Cyrillic}\d\s\-]+$/u";
$subjects = array(12, "ab", "АБ", '--', '__');
foreach($subjects as $subject){
$match = (bool) preg_match($pattern, $subject);
if($match)
echo "$subject matches the testing pattern<br />";
else
echo "$subject does not match the testing pattern<br />";
}
?>
$str="ABC abc 1234 АБВ абв";
$pattern = "/^[a-zA-Z\p{Cyrillic}0-9\s\-]+$/u";
$result = (bool) preg_match($pattern, $str);
if($result)
echo "$str is composed of Cyrillic and alphanumeric characters\n";