We all know the code example of PHP filter string:
- < ?php
- nl2br();
- // n to <br/>
- addslashes(); stripslashes();
- //Escape special characters when operating on the database
-
chop();
- //Remove the spaces on the right side of the string
- trim(); All spaces
- ltrim();
- //Remove spaces on the left side of the string
- htmlspecialchars ();
- //Convert '$','"','
-
< ', '>' are the corresponding html entities htmlentities();
- //Convert all html tags into corresponding html entities
- array explode(string separator, string str);
- //Split string
- string implode(string separator, array arr);
- //Connection string
- strtoupper(); strtolower();
- //Convert case
- ucfirst();
- //Convert only the first character to uppercase
- ucwords();
- //Convert the first letter of each word to uppercase
?>-
I hope you can gain a deeper understanding of this knowledge through the PHP string filtering method introduced in this article.
http://www.bkjia.com/PHPjc/446234.html
www.bkjia.com
truehttp: //www.bkjia.com/PHPjc/446234.htmlTechArticleWe all know the code example of PHP filtering string: ?php nl2br(); //nto br / addslashes ();stripslashes(); //Escape special characters when operating on the database chop(); //Remove the right side of the string...
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