PHP syntax (3) _ PHP Tutorial

Source: Internet
Author: User
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...

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.