How php converts variables to array types
The knowledge of this article "php how to convert variables into array types" is not understood by most people, so the editor summarizes the following contents, detailed contents, clear steps, and certain reference value. I hope you can get something after reading this article. Let's take a look at this "php how to convert variables into array types" article.
The method of converting to an array type: 1, add the target type "(array)" enclosed in parentheses before the numeric variable to be converted, and the syntax "(array) convert variable"; 2, use the settype () function, and the syntax "settype (conversion variable,"array").
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Php converts variables to array types
Method 1: add the target type "(array)" enclosed in parentheses before the numeric variable to be converted
(array): converting to an array type
Example:
Method 2: use the settype () function
The settype ($var, $type) function sets the variable $var to a value that can be set by the specified type $type,$type:
"boolean" (or "bool", starting with PHP 4.2.0)
"integer" (or "int", starting with PHP 4.2.0)
"float" (available only after PHP 4.2.0, "double" used in older versions is now disabled)
"string"
"array"
"object"
"null" (since PHP 4.2.0)
Note: the settype () function changes the type of the variable itself.
Example:
The above is about the content of this article on "how php converts variables to array types". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.