Php notes: analysis of data types and constants. SetType-set the variable type boolsettype (mixed $ var, string $ type) to set the var type to type. The possible value of type is: "boolean" (or "bool", from
SetType-set the variable type
Bool settype (mixed $ var, string $ type)
Set the var variable type to type.
The possible value of type is:
• "Boolean" (or "bool", starting from PHP 4.2.0)
• "Integer" (or "int", starting from PHP 4.2.0)
• "Float" (available only after PHP 4.2.0, and "double" used in earlier versions is disabled now)
• "String"
• "Array"
• "Object"
• "Null" (from PHP 4.2.0)
If the call succeeds, TRUE is returned. if the call fails, FALSE is returned.
Intval (), floatval (), stringval () does not change the type of the original variable.
Isset-check whether the variable is set
Bool isset (mixed $ var [, mixed $ var [, $...])
If var exists, TRUE is returned; otherwise, FALSE is returned.
If unset () is used to release a variable, it will no longer be isset (). If you use isset () to test a variable that is set to NULL, FALSE is returned. Note that a NULL byte ("\ 0") is not equivalent to the NULL constant of PHP.
Note: warning isset () can only be used for variables, because passing any other parameter will cause a parsing error. To check whether a constant has been set, use the defined () function.
Empty-check whether a variable is empty
Bool empty (mixed $ var)
If var is a non-null or non-zero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, array (), var $ var; and objects without any attributes will be considered empty, if var is null, TRUE is returned. no warning is triggered when no value is set for the variable.
Unset-release given variables
Void unset (mixed $ var [, mixed $ var [, $...])
Unset () destroys the specified variable. Note that in PHP 3, unset () will return TRUE (actually an integer value of 1). in PHP 4, unset () is no longer a real function: it is now a statement. In this way, no return value is returned. an attempt to obtain the return value of unset () will cause a parsing error.
Gettype-get the variable type
String gettype (mixed $ var)
Returns the PHP variable type var.
Variable type test function
Is_bool ()
Is_int ()
Is_integer ()
Is_long ()
Is_string ()
Is_float ()
Is_double ()
Is_real ()
Is_array ()
Is_object ()
Is_resource ()
Is_null ()
Is_scalar ()
Is_numberic ()
Is_callable ()
Notes for reading the manual
1. Regular functions
Bool copy (string source, string dest)
2. with mixed, mixed indicates that data of any type can be transferred.
Bool chown (string filename, mixed user)
3. A function with an & parameter indicates that a value is referenced. a value cannot be passed but only one variable can be passed. then, the function changes the value of the variable. when we use this variable, the value also changes.
Bool arsort (array & array [, int sort_flags])
4. the default function has a [] function, indicating that this parameter is optional. if you pass the value, use the value you passed. if the value is not passed, use the default value.
When a function is declared, the initial value is given as a parameter.
Optional and required values, must be set from the back to the front
Bool arsort (array & array [, int sort_flags])
5. the parameter function with... indicates that any number of parameters can be passed.
Int array_unshift (array & array, mixed var [, mixed...])
6. the callback function has callback, that is, when calling this function, we need to pass in a function (function name, function name string)
Array array_filter (array input [, callback])
Http://www.bkjia.com/PHPjc/327162.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327162.htmlTechArticlesetType-set the type of the variable bool settype (mixed $ var, string $ type) to set the type of the variable var to type. The possible value of type is: "boolean" (or "bool", from...