Php (basic, variable, constant, structure statement)

Source: Internet
Author: User
Php (basic, variable, constant, structure statement)

Php beginners (basic, variables, constants, structural statements). If you need them, refer.


Basic knowledge:
?> It can be omitted that the string connector is. annotation // variable
The variable must start with $ and start with a letter or underscore (_).
It can only consist of letters, numbers, and "_" and contain Chinese characters
The case-sensitive "var_dump" function can display the data type of our Variables. it has a line feed. when we use the "echo" command to output the Boolean type, if it is "true", "1" is output, and "false" is output nothing. when the double quotation marks contain variables, the variables are connected with the content in the double quotation marks;
When a single quotation mark contains a variable, the variable is used as a string to output a long string: a constant of the separator <+ any identifier + content + identifier
Define defines system constants
(1) _ FILE _: php program FILE name. It helps us to obtain the physical location of the current file on the server.
(2) _ LINE _: Number of PHP program files. It tells us the number of lines in the current code.
(3) PHP_VERSION: version number of the current parser. It tells us the version number of the current PHP parser. we can know in advance whether our php code can be parsed by the PHP parser.
(4) PHP_ OS: name of the operating system for executing the current PHP version. It tells us the name of the operating system used by the server. we can optimize the constant value of our code based on the operating system.
Directly use the constant name mixed constant (string constant_name); // multiple types of information are returned, and the error message bool defined (string constants_name) is returned if the variable is defined.
... = // Connect the statements with a value assignment structure
(1) only values, not subscript

Foreach (array as value ){
// Executed task
}
?>

(2) obtain both the subscript and value.

Foreach (array as subscript => value ){
// Executed task
}
?>

Php

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.