How to convert php string to array: first create a PHP sample file; then define a string; then convert the string into an array through the "str_split($str);" method; finally print out the conversion The result is enough.
Recommended: "PHP Video Tutorial"
Operating environment for this tutorial:
Windows7 system, PHP5.6 version
Suitable for all brands of computers
##PHP Convert a string into an array str_split
Convert a continuous string into a single character arrayExample:<?php $str = 'abcde'; $arr1 = str_split($str); print_r($arr1); ?>
Array ( [0] => a [1] => b [2] => c [3] => d [4] => e )
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!