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