PHP carriage return and space character replacement function_PHP tutorial

WBOY
Release: 2016-07-13 10:55:35
Original
1150 people have browsed it

The article introduces some special character replacement in PHP development. Students in need can take a look.

// Function name: ReplaceSpacialChar($C_char)

// Function: Special character replacement function

// Parameter: $C_char (string to be replaced)

//Return value: string

// Note: There is a problem with this function and it needs to be tested before it can be used

//--------------------------------------------- ----------------------------------------

The code is as follows
 代码如下 复制代码


function ReplaceSpecialChar($C_char)

{

$C_char=HTMLSpecialChars($C_char); //将特殊字元转成 HTML 格式。

$C_char=nl2br($C_char); //将回车替换为

$C_char=str_replace(" "," ",$C_char); //替换空格为

return $C_char;

}

Copy code

function ReplaceSpecialChar($C_char)

{

$C_char=nl2br($C_char); //Replace carriage return with $C_char=str_replace(" "," ",$C_char); //Replace spaces with return $C_char; }
http://www.bkjia.com/PHPjc/632241.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632241.htmlTechArticleThe article introduces some special character substitutions in PHP development. Students in need can take a look. // Function name: ReplaceSpacialChar($C_char) // Function: Special character replacement function // Parameters...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!