Why use trim () to trim user-entered data?

Source: Internet
Author: User
I've seen a lot of programs trim user input data with trim,
Why do you do this?

The introduction of the book is to say that it is for the sake of safety.

I'm kind of wondering, which one of the students is talking about


Reply to discussion (solution)

Trim can be???? Space.
If you use?? Into the?? Is
$data = ";
What about using if ($data = = ")? Returns false, because the????
But I?? Look, if it's all in?? It's all spaces, is it intentional,??? Null character?
So use trim ($data); Give me a hand. Space? In addition, if there is a character, then it means to use???, in addition, you can use the space to remove.

Example $data = ' AAA ';
echo Trim ($data); Aaa

It's all right with security, and it's not necessary.

Registration is unavoidable to operate a number of blank space, at least the end of the removal

  • 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.