PHP Coding Specification (_php) tutorial

Source: Internet
Author: User
8.4 Variables

In addition to the variable name, all instances, including classes, class constants, are mixed in case, the first letter is lowercase, and then the first letter of the word is capitalized. The variable name should not begin with an underscore or dollar sign, although this is syntactically permissible.
Variable names should be short and descriptive. The choice of variable name should be easy to remember, that is, can indicate its use. Try to avoid the variable name of a single character unless it is a one-time temporary variable. Temporary variables are usually named I,j,k,m and N, which are generally used for integer types; c,d,e, which are generally used for character types.

Char $c;
int $i;
float $myWidth;
8 Instance variables

Casing rules are similar to variable names, except that you need an underscore before

int $_employeeid;
String $_name;
Customer $_customer;
8.6 Constants

The declarations of class constants and ANSI constants should all be capitalized, and the words should be separated by underscores. (Avoid ANSI constants and easily cause errors)

static final int $MIN _width = 4;
static final int $MAX _width = 999;
static final int $GET _the_cpu = 1;


http://www.bkjia.com/PHPjc/532582.html www.bkjia.com true http://www.bkjia.com/PHPjc/532582.html techarticle 8.4 variables except for variable names, all instances, including classes, class constants, are mixed in case, the first letter is lowercase, and then the first letter of the word is capitalized. Variable ...

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