Home  >  Article  >  Backend Development  >  Introduction to specific methods of filtering strings in PHP_PHP Tutorial

Introduction to specific methods of filtering strings in PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-15 13:31:10893browse

We all know the code example of PHP filter string:

  1. < ?php
  2. nl2br();
  3. // n to <br/>
  4. addslashes(); stripslashes();
  5. //Escape special characters when operating on the database
  6. chop();
  7. //Remove the spaces on the right side of the string
  8. trim(); All spaces
  9. ltrim();
  10. //Remove spaces on the left side of the string
  11. htmlspecialchars ();
  12. //Convert '$','"','
  13. < ', '>' are the corresponding html entities htmlentities();
  14. //Convert all html tags into corresponding html entities
  15. array explode(string separator, string str);
  16. //Split string
  17. string implode(string separator, array arr);
  18. //Connection string
  19. strtoupper(); strtolower();
  20. //Convert case
  21. ucfirst();
  22. //Convert only the first character to uppercase
  23. ucwords();
  24. //Convert the first letter of each word to uppercase
  25. ?>
  26. 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

http: //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