English 中文(简体)
如何删除非美国人关于扼杀的函件?
原标题:How to get rid of the non-english letters on the string?

我想在座右铭中摆脱与驻军的污名,我写了这一功能。 然而,在服务器中,它不承认这些信件。 任何建议?

function strtolower_tr($string)
    {
        $low=array("Ü" => "U","ü" => "u", "Ö" => "O","ö" => "o", "Ğ" => "G","ğ" => "g", "Ş" => "S","ş" => "s", "Ç" => "C","ç" => "c", "İ" => "I","i" => "i", "I" => "i","I" => "I");
        return strtolower(strtr($string,$low));
    }

------

$low=array("?~" => "u?", "?~V" => "o?", "?~^" => "g", "?~^" => "s", "?~G" => "c", "İ" => "i", "I" => i");

EDITED:

I found this: However, its not working for letter ı and I setlocale(LC_ALL, en_US.UTF8 ); function clearUTF($s) { $r = ; $s1 = @iconv( UTF-8 , ASCII//TRANSLIT , $s); $j = 0; for ($i = 0; $i < strlen($s1); $i++) { $ch1 = $s1[$i]; $ch2 = @mb_substr($s, $j++, 1, UTF-8 ); if (strstr( `^~ " , $ch1) !== false) { if ($ch1 <> $ch2) { --$j; continue; } } $r .= ($ch1== ? ) ? $ch2 : $ch1; } return $r; }

问题回答

Is you file in utf encoding? You should use utf encoding for your source files, this will solve your problem.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签