UTF-8下的PHP全角标点转为半角

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>  
 
<?php  
    $str = "0123ABCDFWS\",.?<>{}[]*&^%#@!~()+-|:;";  
    echo "$str";  
    echo "<br />";  
    $str = iconv('utf-8', 'gbk', $str);
    @$str = preg_replace('/\xa3([\xa1-\xfe])/e', 'chr(ord(\1)-0x80)', $str);  
    echo $str;

你可能感兴趣的:(UTF-8下的PHP全角标点转为半角)