: This article mainly introduces the basic data types of PHP. if you are interested in the PHP Tutorial, refer to it.
- PHP reference type
- PHP Boolean type
- PHP string type
- String declaration
- Use and declaration
- Arbitrary string using the delimiter
- Differences between single quotes and double quotes
- PHP constants
- Constant declaration name
- Constant usage
- Note:
PHP reference type
The PHP reference type is similar to the "reference type" in C ++, which is equivalent to the alias of a variable. The syntax is as follows:
The variableBYesvariableA.
Note:
- Only variables are referenced.
- A variable value (suchB), The value of another variable (A) Will also change.
" ; echo"b = $b" ;?>
- In use
unset()Function, if there is a reference relationship, just removed this reference relationship, deleted an alias, and the other is
- If two variables are reference relationships, if the value assigned to one of the variables is a new reference, you can choose to change the reference relationship.
" ;// a = 100echo"b = $b
" ; // b = 25echo"c = $c" ; // c = 25?>
PHP Boolean type
booleanType variable value can betrue,false
- When other types of variables are converted to the Boolean type, the following values represent
false:
- Integer:
0
- Floating point type:
0
- String:
"","0"
- Array:
array()
- Special type:
Null
PHP string type
String declaration
Use""And''Statement
- One or more characters in PHP are strings;
- To declare a string in PHP, you must use"Single quotes"Or"Double quotation marks;
- Single quotation marks and double quotation marks are not allowed in single quotes;
- You can use single quotes in double quotes, but not double quotes;
- If you want to use double quotation marks to emphasize certain phrases in a string, you can use transfer characters.
"\".
Use delimiters<+ Any string
Differences between single quotes and double quotes
- Variables can be parsed in double quotes, but not in single quotes.
- Escape characters can be used in double quotation marks, but not in single quotation marks (only escapeSingle quotesAndEscape characters)
PHP constants
Constant declaration and naming
- Declaration: use functions
define(string name, mixedtype value)
- Name: a string starting with an underscore (_) or a letter, usually in upper case.
Constant usage
"; echo constant("CONSTANT"); }?>
Note:
- The constant value cannot be changed.
- Constants only support standard data types
- Constants cannot be used.
unset()Function clearing
define()The third parameter of the function determines whether the constant name supports case sensitivity.
** To Be Continued ······**
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes the basic data types of PHP, including the content, and hope to help those who are interested in the PHP Tutorial.