I am tring to convert an array to string, than wanna change some chracters with str_replace. Everything works fine except convertion. What is the proplem in my code?
function tr_cevir($text = "") {
//converts turkish charters in to english chracters
$TR = array('ç', 'Ç', 'ı', 'İ', 'ş', 'Ş', 'ğ', 'Ğ', 'ö', 'Ö', 'ü', 'Ü', 'I');
$EN = array('c', 'c', 'i', 'i', 's', 's', 'g', 'g', 'o', 'o', 'u', 'u', 'i');
$text = str_replace($TR, $EN, $text);
$text = str_replace(" ", "", $text);
return $text;
}
$my_array = array(çali, Şeli, Ğahmet);
$string = implode(", ", $my_array);
$string_converted = tr_cevir($string);
echo $string_converted; //output returns null
How can i get the output like:
cali,seli,gahmet
Try replacing your whole code with this:
iconv()