PHP syntax (3)

Source: Internet
Author: User
The previous article "talk about PHP syntax" has talked about PHP Data types and expressions. Now let's take a look at the variables and constants of PHP. Let's take a look at this example first. File: test. phpSyntaxHighlighter. all (); news & nbsp; the previous article "talk about PHP syntax" has talked about PHP Data types and expressions. Now let's take a look at the variables and constants of PHP.
Let's take a look at this example first.
File: test. php
// This is a single line comment method
# This is another single line comment method
/* This is a multiline comment method.
Let's take a look at the example below */
Funtion display ($ file, $ line)
{
Global $ message;
Echo "FILE: $ file
";
Echo "LINE: $ line
";
Echo "Message: $ message
";
} $ Message = "this is a routine. ";
Display (_ FILE _, _ LINE _);
?>
The result is as follows:
Text. php
15

 

 

 

 

 

 

 

 

 

 

This is a routine

In the preceding example, function is a custom function. The following two variables $ file and $ line are two local variables. they only play a role in the function body, and they are changed in vitro ?? The amount does not interfere with each other. if there is $ file or $ line in the function body, the values of two $ files and two $ lines may not be the same. _ FILE _ and _ LINE _ are two constants. Their ?? The value is already set. _ FILE _ is the object name, and _ LINE _ is the row number of the execution LINE. In the function body, there is a global $ message. its function is to make all ?? The local variable $ message can be used in the function body. this statement can also be written as $ GLOBAL ["message"];
For information generated by GET, POST, and Cookie mechanisms, PHP automatically treats it as a PHP variable. In this way, the information processing of the submitted form is extremely easy. As follows:
File: form.html






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.