A variable is NULL
considered in the following cases:
NULL
Type has only one value, which is a case insensitive keyword NULL
(you can write null or write null).
Converting a variable to a null type will delete the variable and unset its value.
Type conversions
PHP does not need (or does not support) explicit type definitions in variable definitions; The variable type is determined by the context in which the variable is used. In other words, if you assign a string value var
to var
a variable, it becomes a string. If you assign an integer value to var
it, it becomes an integer.
An example of automatic type conversion for PHP is the plus sign "+". If any one operand is a floating-point number, all operands are treated as floating-point numbers, and the result is a floating-point number. Otherwise the operand is interpreted as an integer, and the result is an integer. Note that this does not change the type of the operands themselves; it only changes how the operands are evaluated and the type of the expression itself.
The type casts in PHP are very similar to those in C: precede the variables to be converted with the target type enclosed in parentheses.
- (int), (integer)-Convert to Integer (integer)
- ( bool), (Boolean)-Converts to Boolean (Boolean)
- ( float), (double), (real)-Convert to floating-point (float)
- (String)-Convert to string (string)
- (binary)-converted to binary string ( string) (PHP 6)
- (Array)-Converts to arrays (array)
- (object)-Convert to object (objects)
- (unset)-Convert to NULL (PHP 5)
The (binary) conversion will precede the result with the prefix ' B ', PHP 5.2.1 new.
http://www.bkjia.com/PHPjc/325298.html www.bkjia.com true http://www.bkjia.com/PHPjc/325298.html techarticle A variable is considered null in the following cases: is assigned a value of NULL. has not been assigned a value. Be unset (). The null type has only one value, which is the case insensitive keyword null ( ...).