Is there a difference in the capitalization of variable names, function names, and so on in PHP? Example

Source: Internet
Author: User
For beginners of new PHP, often encounter such a problem, PHP is case-sensitive? is PHP case sensitive? are PHP functions case-sensitive? are PHP custom functions case-sensitive? If so, what is the difference between the case and casing? So in response to these questions, this article will give you a detailed introduction to summarize about the PHP case-related knowledge points. Hope to be helpful to the needy friend.

First, the PHP variable is case-sensitive

The PHP variable name size distinguishes code example as follows:

As the code above, we set the value of the variable ABC to ABC, then the value of the PHP output ABC is ABC, but if we change the case of the variable, we will find that the result is not lost. So remember that PHP variables are case-sensitive!

Second, the constant name is case-sensitive by default

The code examples are as follows:

As above code, we define the constant value for Hello World at this time output ABC value for Hello World.

Note: PHP.ini configuration item directives are case-sensitive as File_uploads = 1 cannot be written as File_uploads = 1

Method name, class name, function name are case-insensitive

It is recommended to use the same name as the definition!

The code examples are as follows:

Iv. Magic constants are case-insensitive

We recommend using Uppercase! Such as:

Five, TRUE, FALSE, null case insensitive

The code examples are as follows:

In PHP, variables are stored in the structure of the C language, empty strings and null,false are stored with a value of 0, and the type of an empty string is the type of string,null that is Null,false is Boolean. Typically 0, 1 equals false, True.

This is a summary of the relevant questions about PHP case. Have a certain reference value, hope to have the help of friends in need!

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.