";print_r($arr);echo ""; }$a = "river crab) (socialafeowa#$%^!@"/> ";print_r($arr);echo ""; }$a = "river crab) (socialafeowa#$%^!@">

Home  >  Article  >  Backend Development  >  PHP remove Chinese characters from string

PHP remove Chinese characters from string

WBOY
WBOYOriginal
2016-07-28 08:29:591674browse

一The Chinese, delete a Chinese Chinese in the Chinese, as long as the Chinese characters are replaced in a regular way as an empty character:

<?php
header(&#39;Content-type:text/html;charset=utf-8&#39;);


function p($arr){
	echo "<pre class="brush:php;toolbar:false">";
	print_r($arr);
	echo "
"; } $a = "河蟹)(社会afeowa#$%^!@@#zf吃饭fawgwea汉堡包agho_iawghowi我日)"; $result = preg_replace('/([\x80-\xff]*)/i','',$a); p($result); ?>


The above introduces PHP to remove Chinese characters from strings, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn