PHP short tags, quotation marks, naming problems

Source: Internet
Author: User
Tags parse error

Learning PHP Soon, there are a lot of small details on the problem. Recorded here.

Today write a simple user registration and display information on the original page of the applet.

After the local Apach debugging can be displayed normally, but when I put the source on another server, and then access through the domain name can not display the page normally. And the following error occurred:

Parse Error: syntax error, unexpected $end in D:\apache\htdocs\task-1\task-1.php on line 178

The content referred to is simply:

    }?>

After inquiry understand, <??> is a PHP short tag that can be turned on or off in the PHP root. ini file to be Short_open_tag set to off/on. for different environment configurations

Vary. <?php?> is a standard PHP tag and is used in any configuration, so it's best to use <?php?>. In addition, there are similar to ASP tag <%%>

Open and close in the. ini file.

Quotation mark problem

$_post["name"] and $_post[name] can be used, but the execution efficiency of $_post["name"] is much faster than $_post[name. Because $_post[name]

During execution, name is used as a constant and only the name constant is not found as the index reference to post. And in some special cases, the $_post[name] will result in a wrong

The result of the error. For example:

There is already a define (' name ', ' value '); In this case, if you use $_post[name] again, it will be treated as $_post["value", causing an error to occur.

Naming issues

Good naming habit can not only greatly increase the readability of the program, but also help us to make mistakes. A good naming system can be more effective for the different modules of the program is better understood by different programmers,

Smoother connections, while also improving efficiency.

PHP short tags, quotation marks, naming problems

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.