Home>Article>Backend Development> How to convert php string to array bitwise
In PHP, you can use the str_split() function to convert a string into an array bitwise. This function can split the string into an array. You only need to omit the second parameter, or set the value to "1 ", you can split the string, split the string into characters one by one, and pass it into the array bit by bit; the syntax is "str_split("string")".
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In php, you can use str_split () function converts a string into an array bitwise.
The str_split() function can split a string into an array.
This function supports two parameters, the syntax is
str_split(string,length)
string: required. Specifies the string to be split.
#length: Optional. Specifies the length of each array element. The default is 1.
When you only need to omit the second parameter, or set the value to "1", you can split the string, split the string into characters one by one, and pass it in bit by bit In an array, as an array element.
Example:
Extended knowledge:
str_split() function cannot separate Chinese characters The problem can be solved by using the following code:
Recommended: "PHP Video Tutorial"
The above is the detailed content of How to convert php string to array bitwise. For more information, please follow other related articles on the PHP Chinese website!