We all knowSample Code for PHP to filter strings:
- <? Php
- Nl2br ();
- // N<Br/>
- Addslashes (); stripslashes ();
- // Escape special characters for database operations
- Chop ();
- // Remove spaces on the right of the string
- Trim ();
- // Remove all spaces in the string
- Ltrim ();
- // Remove the left space of the string
- Htmlspecialchars ();
- // Convert '$ ','"','<','>'Is the corresponding html Object
- Htmlentities ();
- // Convert all html tags to corresponding html entities
- Array explode (string separator, string str );
- // Split the string
- String implode (string separator, array arr );
- // Connection string
- Strtoupper (); strtolower ();
- // Converts uppercase and lowercase letters.
- Ucfirst ();
- // Only converts the first character to uppercase.
- Ucwords ();
- // Convert the first letter of each word to uppercase.
- ?>
We hope that you can gain an in-depth understanding of this knowledge point through the PHP filter string method described in this article.