国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Learning php annotations

The function of annotation is very powerful

The so-called annotation can be explained in Chinese as: annotation. More accurate.
Because the code is in English and the code is very long, people will forget it after a long time.
So we will add comments.

Comments have many functions:

1. Mark the key points

2. It is easy to forget to recall quickly after a long time, making it easy to find

3. Let others understand quickly when they read it

4. You can also generate documents. After the code is written, the relevant documents are finished, improving work efficiency

5. Comments, blank lines, and carriage returns The subsequent code will look more beautiful

6. Comments can be used for troubleshooting. If you are not sure which part of the code is wrong, you can comment a large section to determine the error range

7. The computer will not execute the content in the middle of the comment

Let me give it to you first Take a look at the code that we think is beautiful, neat, standardized, clearly explained, and easy to understand at a glance. (No need to understand the meaning of the code):

2015-07-26_55b45e4f5550a.png

Let’s look at the code that we think is ugly, not to mention the alignment and ugliness, and there is no functional description (no need to understand the meaning of the code) ):

2015-07-26_55b45dfadd672.png

We have learned about the benefits of comments. Next, let’s talk about PHP comments. The comments are:

  • # #Single-line comment (comment only one line)

  • Multi-line comment (comment multiple lines)

  • Single-line comments

  • //   表示單行注釋
    #    #號也表示單行注釋,用的比較少
  • Multi-line comments

  • /* 
    多行注釋 這里是注釋區(qū)域代碼
     */

Single-line comment example:

<?php

//聲明一部iphone6手機(jī)的價格變量
$iphone6_price = 6088;

//顯示輸出手機(jī)價格
echo $iphone6_price;
?>

Note: From the above example, we know that comments are usually written above the code.

Example of multi-line comments:

<?php
/*
作者:PHP中文網(wǎng)
時間:2048.12.23
功能:這是一個假的多行注釋的例子
*/

/*
  聲明一個愛情變量
  $love 是指愛情
  愛情是一個變量,因為人的愛總是在發(fā)生變化
  所以,愛情變量的值為250
*/
$love = 250;

?>

Note: Through the above example, we found that when we want to write a lot of comments, use multi-line comments.

Note: I will not explain how to generate comments through special tools for now

Continuing Learning
||
<?php //聲明一部iphone6手機(jī)的價格變量 $iphone6_price = 6088; //顯示輸出手機(jī)價格 echo $iphone6_price; ?>
submitReset Code