lang
1string iconv( string $in_charset, string $out_charset, string $str)
2``` を使うといいと思います。
3下記マニュアル
4[http://www.php.net/manual/ja/function.iconv.php](http://www.php.net/manual/ja/function.iconv.php)
5
6これがコードです:
7
8```lang-<ここに言語を入力>
9setlocale(LC_ALL, 'en_US.UTF8');
10
11function testFormat($str, $replace=array(), $delimiter='-') {
12 if( !empty($replace) ) {
13 $str = str_replace((array)$replace, ' ', $str);
14 }
15
16 $arg = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
17 $arg = preg_replace("/[^a-zA-Z0-9/_|+ -]/", '', $str);
18 $arg = strtolower(trim($arg, '-'));
19 $result = preg_replace("/[/_|+ -]+/", $delimiter, $arg);
20
21 return $result;
22}
23$str = "Hallo World *!@#$%^&*()eingeben...";
24echo testFormat($str);
25//出力: hallo-world-eingeben
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。