Home  >  Article  >  Backend Development  >  Several useful PHP string filtering and conversion function codes_PHP tutorial

Several useful PHP string filtering and conversion function codes_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:19:20862browse

nl2br();// n to

addslashes(); stripslashes();//When operating on the database, escape special characters

chop();//Remove the spaces on the right side of the string
trim();//Remove all spaces in the string
ltrim();//Remove the spaces on the left side of the string

htmlspecialchars();//Convert '$','"', '<','>' are corresponding html entities
htmlentities();//Convert all html tags to corresponding html entities

array explode(string separator, string str);// Split string
string implode(string separator, array arr);//Connect string

strtoupper(); strtolower();//Convert case
ucfirst();//Only Convert the first character to uppercase
ucwords();//Convert the first letter of each word to uppercase

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325289.htmlTechArticlenl2br();// n to addslashes(); stripslashes();//When operating on the database, transfer special characters chop();//Remove the spaces on the right side of the string trim();//Remove all spaces in the string ltrim();//Remove...
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