How are you. Hope Fine...
I am facing a problem with the following code. The strtr
function isn't working. It doesn't output anything...
if ($translate == "DrChatrikWeb") {
$convertarray = array(
"~" => "~",
"!" => "!",
"@" => "@",
"#" => "#",
"$" => "$",
"%" => "%",
"^" => "^",
"&" => "&",
"*" => "*",
"(" => "(",
")" => ")",
"_" => "_",
"+" => "+",
"`" => "`",
"1" => "1",
"2" => "2",
"3" => "3",
"4" => "4",
"5" => "5",
"6" => "6",
"7" => "7",
"8" => "8",
"9" => "9",
"0" => "0",
"-" => "_",
"=" => "=",
"Q" => "ਥ",
"W" => "ੱ",
"E" => "ਓ",
"R" => "੍ਰ",
"T" => "ਠ",
"Y" => "ੈ",
"U" => "ੂ",
"I" => "ੀ",
"O" => "ੌ",
"P" => "ਫ",
"{" => "{",
"}" => "}",
"|" => "।",
"q" => "ਤ",
"w" => "ੱ",
"e" => "ੲ",
"r" => "ਰ",
"t" => "ਟ",
"y" => "ੇ",
"u" => "ੁ",
"i" => "ਿ",
"o" => "ੋ",
"p" => "ਪ",
"[" => ".",
"]" => "॥",
"\\" => "\\",
"A" => "ੳ",
"S" => "ੰ",
"D" => "ਧ",
"F" => "ਾਂ",
"G" => "ਘ",
"H" => "੍ਹ",
"J" => "ਝ",
"K" => "ਖ",
"L" => "਼",
":" => ":",
"\"" => "\"",
"a" => "ਅ",
"s" => "ਸ",
"d" => "ਦ",
"f" => "ਾ",
"g" => "ਗ",
"h" => "ਹ",
"j" => "ਜ",
"k" => "ਕ",
"l" => "ਲ",
";" => ";",
"'" => "'",
"Z" => "ਢ",
"X" => "ਯ",
"C" => "ਛ",
"V" => "ੜ",
"B" => "ਭ",
"N" => "ਂ",
"M" => "ੰ",
"" => ",",
">" => ">",
"?" => "?",
"z" => "ਡ",
"x" => "ਣ",
"c" => "ਚ",
"v" => "ਵ",
"b" => "ਬ",
"n" => "ਨ",
"m" => "ਮ",
"" => ",",
"." => "।",
"/" => "/",
"¡" => "ੴ",
"«" => "॥",
"¬" => "#",
"R" => "੍ਰ",
"•" => "•",
"»" => "।",
"Ã" => "ੴ",
"Å" => "ੴ",
"Ç" => "☬",
"È" => "ਸ਼",
"É" => "ਖ਼",
"Ê" => "ਗ਼",
"Ë" => "ਜ਼",
"Ì" => "ਫ਼",
"Î" => "੍ਯ",
"Ñ" => "#",
"Ò" => "॥",
"Ü" => "ਲ਼",
"ñ" => "੧",
"ò" => "੨",
"ó" => "੩",
"ô" => "੪",
"õ" => "੫",
"ö" => "੬",
"÷" => "੭",
"ø" => "੮",
"ù" => "੯",
"ú" => "੦",
"ƒ" => "ਨੂੰ",
"“" => "“",
"”" => "”",
"Í" => "੍ਵ",
);
$string = strtr($texttoreplace, $convertarray);
echo $string;
}
The array is in Punjabi i.e. is a indic language...
$repp = array(
"<br />" => " <br> ",
" ," => " <punc>,</punc> ",
" ." => " <punc>.</punc> ",
" /" => " <punc>/</punc> ",
" \\" => " <punc>\\</punc> ",
" !" => " <punc>!</punc> ",
" ?" => " <punc>?</punc> ",
" :" => " <punc>:</punc> ",
" ;" => " <punc>;</punc> ",
" \"" => " <punc>\"</punc> ",
" '" => " <punc>'</punc> ",
" (" => " <punc>(</punc> ",
" )" => " <punc>)</punc> ",
" {" => " <punc>{</punc> ",
" }" => " <punc>}</punc> ",
" <" => " <punc><</punc> ",
" >" => " <punc>></punc> ",
" [" => " <punc>[</punc> ",
" ]" => " <punc>]</punc> ",
" &" => " <punc>&</punc> ",
" $" => " <punc>$</punc> ",
" @" => " <punc>@</punc> ",
" #" => " <punc>#</punc> ",
" %" => " <punc>%</punc> ",
" ^" => " <punc>^</punc> ",
" *" => " <punc>*</punc> ",
" _" => " <punc>_</punc> ",
" =" => " <punc>=</punc> ",
" +" => " <punc>+</punc> ",
" |" => " <punc>|</punc> ",
" -" => " <punc>-</punc> ",
"," => "<> <punc>,</punc> ",
"." => "<> <punc>.</punc> ",
"/" => "<> <punc>/</punc> ",
"\\" => "<> <punc>\\</punc> ",
"!" => "<> <punc>!</punc> ",
"?" => "<> <punc>?</punc> ",
":" => "<> <punc>:</punc> ",
";" => "<> <punc>;</punc> ",
"\"" => "<> <punc>\"</punc> ",
"'" => "<> <punc>'</punc> ",
"(" => "<> <punc>(</punc> ",
")" => "<> <punc>)</punc> ",
"{" => "<> <punc>{</punc> ",
"}" => "<> <punc>}</punc> ",
"<" => "<> <punc><</punc> ",
">" => "<> <punc>></punc> ",
"[" => "<> <punc>[</punc> ",
"]" => "<> <punc>]</punc> ",
"&" => "<> <punc>&</punc> ",
"$" => "<> <punc>$</punc> ",
"@" => "<> <punc>@</punc> ",
"#" => "<> <punc>#</punc> ",
"%" => "<> <punc>%</punc> ",
"^" => "<> <punc>^</punc> ",
"*" => "<> <punc>*</punc> ",
"_" => "<> <punc>_</punc> ",
"=" => "<> <punc>=</punc> ",
"+" => "<> <punc>+</punc> ",
"|" => "<> <punc>|</punc> ",
"-" => "<> <punc>-</punc> "
);
$repps = strtr($texttoreplace, $repp);
echo $repps;
Plzz Help..
it's this pair causing the issue, remove it and it works
"" => ",",
as the manual says:
If replace_pairs contains a key which is an empty string (""), FALSE will be returned.