Home >php教程 >php手册 >PHP function code to replace special characters in extremely long text_php basics

PHP function code to replace special characters in extremely long text_php basics

WBOY
WBOYOriginal
2016-05-16 09:00:291258browse
Copy Code The code is as follows:

function unhtml($content){
$content=htmlspecialchars ($content);
$content=str_replace(chr(13),"
",$content);
$content=str_replace(chr(32),"
",$content) ;
$content=str_replace("[_[","$content=str_relace(")_)",">",$content);
$content =str_replace("|_|","",$content);
rerurn trim($content);
}


PHP str_replace() function

Definition and usage
The str_replace() function uses a string to replace other characters in a string.

Syntax
str_replace(find,replace,string,count)
Parameters Description
find Required. Specifies the value to look for.
replace Required. Specifies the value that replaces the value in find.
string Required. Specifies the string to be searched for.
count Optional. A variable counting the number of substitutions.
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