Why are there extra special characters in PHP output?

Source: Internet
Author: User
Why are extra special characters in PHP output? My intention is to only output y, but I don't know why there will always be an extra [] & nbsp ;. & Nbsp; check userName $ userName & nbsp; $ _ POST [username]; if (! Preg_match (^ [0-9a-why are extra special characters in PHP output?
My intention is to only output y, but I don't know why there will always be an extra [].

// Verify the user name
$ UserName = $ _ POST ['username'];
If (! Preg_match ('/^ [0-9a-zA-Z] {3, 16} $/', $ userName )){
Die ();
}
// Determine whether the user already exists
Require ('./../inc/pdo_conn.php ');
$ HPdoPre = $ hPdo-> prepare ("SELECT user_name FROM user WHERE user_name =: username ");
$ HPdoPre-> bindParam (': username', $ username, PDO: PARAM_STR );
$ HPdoPre-> execute ();
$ Result = $ hPdoPre-> fetchAll ();

// If it is null, you can register
If (empty ($ result )){
Echo 'y ';
} Else {
Echo 'n ';
}

It's really anxious. after testing, we found that only y is output normally after the require part is removed, but there is no output in this part, and there is no problem elsewhere. Really helpless, for help
------ Solution --------------------
Check whether the pdo_conn.php file contains the BOM.
------ Solution --------------------
BOM word patch
------ Solution --------------------
Do not use notepad to write a program. use editplus to save it as one and remove BOM.

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.