PHP syntax (3 ). 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 type of PHP Data type and expression discussed in the previous article "talk about PHP syntax. 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 do not interfere with the variation amount of the function in vitro, if $ file or $ line exists in the function body, the values of both $ file and $ line may not be the same. _ FILE _ and _ LINE _ are two constants. their limit values have been fixed. _ FILE _ is the object name, and _ LINE _ is the row number of the execution LINE. In the function body, there is also a global $ message, which is used to enable the fully qualified variable $ message to function body, this sentence 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
Bytes. 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...