Two methods to convert PHP string to array:
Use str_split(), do not join The second parameter is added to the array character by character.
Related recommendations: "PHP Getting Started Tutorial"
Save the file and check the print of str_split() without adding the second parameter result.
#str_split() adds the second parameter, and the length of the single element of the array is specified.
Recommended manual:php complete self-study manual
Save the file and view str_split() Add the print result of the second parameter.
Use the explode() method
View the array splitting effect of explode().
Recommended related articles:
1.Explanation of PHP string to array and array to string functions
Related video recommendations:
1.Dugu Jiujian(4)_PHP video tutorial
The above is the detailed content of How to convert php string to array. For more information, please follow other related articles on the PHP Chinese website!