How to filter strings in PHP

Source: Internet
Author: User

We all knowSample Code for PHP to filter strings:

  1. <? Php
  2. Nl2br ();
  3. // N<Br/> 
  4. Addslashes (); stripslashes ();
  5. // Escape special characters for database operations
  6. Chop ();
  7. // Remove spaces on the right of the string
  8. Trim ();
  9. // Remove all spaces in the string
  10. Ltrim ();
  11. // Remove the left space of the string
  12. Htmlspecialchars ();
  13. // Convert '$ ','"','<','>'Is the corresponding html Object
  14. Htmlentities ();
  15. // Convert all html tags to corresponding html entities
  16. Array explode (string separator, string str );
  17. // Split the string
  18. String implode (string separator, array arr );
  19. // Connection string
  20. Strtoupper (); strtolower ();
  21. // Converts uppercase and lowercase letters.
  22. Ucfirst ();
  23. // Only converts the first character to uppercase.
  24. Ucwords ();
  25. // Convert the first letter of each word to uppercase.
  26. ?>

We hope that you can gain an in-depth understanding of this knowledge point through the PHP filter string method described in this article.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.