Constants and variables

Source: Internet
Author: User

The definition of a constant uses the Define () function, two ways to get a constant, one is to use the constant name directly, and the second is to use the constant () function. Determines whether a constant has been defined using the defined () function.
Common pre-defined constants:
__FILE__: Master configuration file path
Php_version: Current PHP version
Php_os: Current system type

After the PHP4 variable does not need to declare, directly to the variable assignment, the variable name is case-sensitive,
Local variables: Using inside a function
Global variables: Acting on the entire PHP file, using the Global keyword declaration
Static variables: After a function call, any value of its variable can be preserved, and the general variable will be deleted after the call is finished, using the keyword static declaration.
Pre-defined variables: These predefined variables allow you to obtain information about the user's session, the environment of the user's operating system, and so on.
--Variable Management

Isset (): Determines whether the variable is set, returns a Boolean value, sets the variable to NULL, and returns false
Unset (): Canceling a defined variable
Empty (): Check if a variable is not declared or the value is False
--Super Global variables
$_env[]: Contains an array of environment variables
$_server[]: Storing an array of Web servers

Constants and variables

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: 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.