Constants What is a constant
Constants are the amount of value that is never changed. Cannot be modified, cannot be deleted. Named Rule constants have the same naming rules as variables, but not the "$" symbol constant name can only start with a letter, an underscore, not a constant with a number at the beginning of the case is case-sensitive constant as much as all uppercase, and the variable to distinguish; such as: Db_host, TITLE, CONTENT Constant definition define ()
Description: Defines a constant
Syntax: BOOL Define (String $name, mixed $value [, bool $case _insensitive = false])
Parameters:
$NAME constant name;
The value of the $value constant;
$ case_insensitive, case sensitive, false (case-sensitive), true case-insensitive constant judgment defined ()
Description: Checks whether a constant of a name exists
Syntax: bool defined (string $name)
Tip: The constant name must be a string. PHP Predefined Constants
php_version:php Version number
php_os:php Operating System
Maximum integer supported by php_int_max:php
TRUE: is both a constant and a keyword;
FALSE: is both a constant and a keyword.
Note : There are more than 800 predefined constants in PHP. The function get_defined_constants () allows you to get all the predefined constants in PHP. PHP Magic Constants
Magic constants: Constants that can be changed during the program's operation.
__LINE__: Get Current line number
__FILE__: Get the absolute path to the current file
__DIR__: Gets the directory of the current file
__FUNCTION__: Get the name of the current function
__CLASS__: Get current class name
__method__: Get when method name
Note : There are no magic constants in Get_defined_constants () data type data type classification
Scalar (Basic) data types: String, Integer, floating-point, Boolean
Composite data types: arrays, objects
Special data types: Resources, NULL- judged data types
Var_dump (): Print the type and value of the variable;
Is_bool (): Determine whether the variable is Boolean;
Is_int (): Determine whether the variable is integral type;
Is_float (): Judge whether the variable is a floating-point type;
Is_numeric (): Determine whether the variable is a numerical type;
Is_array (): Determines whether the variable is an array;
Is_string (): Determines whether a variable is a string;
Is_null (): Determines whether a variable is null
Is_resource (): To determine whether a variable is a resource-type integral type
Integral type includes: positive integer, negative integer, zero
The representation method of integral type
Decimal notation: $a = 90;
Octal notation: $a = 077; Starting with 0, it's octal.
The range of integers in PHP: -2^31 (-2147483648) ~ 2^31-1 (2147483647). PHP represents the largest integer with Php_int_max. If an integer goes out of range, it is converted to a floating-point number. floating point numbers
Float range: 1.8E-308 ~ 1.8E+308
E is based on 10.
1.8E5: is a scientific counting way. 1.8*10^5 = 180000 string string defines a string of characters that are caused by single quotes. For example: $a = ' abc ' with double quotes, a string of characters that is caused by the. For example: $a = escape characters in "ABC" double quotes, basic can be used: \ \, \, \ n, \$, \ t, \ r. Long string representation: Heredoc identifier, a long string, placed in "<"Heredoc;" Must be a single line and must have a header row. Long string, you can place the HTML, CSS, JS, PHP variables, but not the operation. The Heredoc function, like double quotes, can parse PHP variables.
Note : Within single quotes, output is the name of the variable, can not resolve the variable double quotes, output is the value of the variable, you can resolve the variable in double quotes, if a variable followed by a non-empty character, will be treated as a variable, in fact, there is no such variable in double quotes, If a variable is followed by a punctuation mark in English, you can directly parse the variable boolean Boolean with only two values true, False. The Boolean type is mainly used in the conditional judgment. 0, "", "0", false, NULL, array (), null object, converted to Boolean are considered false. Empty Type
If a variable does not exist, the null type is assumed to have only one value nul resource type
PHP has very few functions, it needs to load Third-party plug-ins to implement other functions. So, third-party plug-ins, for PHP, is its resources. such as: MySQL, GD2, filesystem and so on. A resource is a reference to a third party's data, also known as a "reference pass value"