Php Annotator and format in PHP Getting Started Tutorial

Source: Internet
Author: User
Tags good php editor php editor
Annotation symbols and formats I think many php referers will only be simple or, next, I will introduce to you in detail the annotation symbols and formats in php. For more information, see PHP.

Annotation symbols and formats I think many php referers only use simple // or, next I will give you a detailed introduction to the annotation symbols and formats in php. For more information, see.

PHP Annotator

■ C ++ style: // This is a C + style comment

■ C style:/* This is a C style comment */

■ Unix Shell style: # This is a Unix Shell style comment

Generally, '//' and '/* comment content */' are used. In addition, some system configuration documents, such as php, are used to build the php environment. the annotation symbol in ini is.

PHP comment format

The PHP comment format is divided into single-line comment and multi-line comment.

PHP single line comment

The above three symbols can be used for single-line comments. only when the // or # Annotator is used, the text (within the same line) after the Annotator is considered as the comments, the/**/style annotator must end.

The instance code is as follows:

  1. // This is a single line comment
  2. Echo 'Hi! '; // This is a single line comment
  3. /* Comment */
  4. ?>

The comment at the end of the line above usually only comments the content before the line. the comment for a single line may be comments for the following line or multiple lines of code, it may also be for the overall appearance of the program.

PHP multi-line comment

Multi-line comments generally use a C-style annotator, which starts with/* and ends with */to contain multi-line comments:

The instance code is as follows:

  1. Echo "Hello! ";
  2. /* Multi-line comment content */
  3. ?>

Note:

Do not use the C-style annotator nested, because when the first */is reached, the system considers that the annotation of this paragraph to end. this error is very likely to occur when a large piece of code is commented out. PHP syntax errors may occur if the following statements are used:

The instance code is as follows:

  1. Echo 'Hi! ';
  2. /*
  3. This is a multiline comment
  4. Echo 'output other content';/* added comments of the row */
  5. */
  6. ?>

You can also use the // symbol multiple times to annotate multiple lines of code:

The instance code is as follows:

  1. // Annotation
  2. // Description 1
  3. // Description 2
  4. Echo 'annotation example ';
  5. }
  6. ?>

PHP comments cannot contain the PHP code Terminator:?>, This is because PHP detects the Terminator, that is, it considers that the execution of the PHP code in this section will lead to program errors. another point is that a good php editor can save us a lot of trouble. for example, phpdesigner and zend.

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.