How to convert php array string to array: 1. Use the "implode(" ",$arr);" method to split the array into strings in the specified way; 2. Use "explode(" ", $ pizza);" method merges strings into arrays according to specified rules.
#Environment of this article: Windows7 system, PHP7.1, Dell G3 computer.
Recommended: "PHP Video Tutorial"
PHP String to Array and Array to String
//数组按指定方式分割为字符串 $arr = array('Hello','World!','I','love','Shanghai!'); echo implode(" ",$arr); //字符串按指定规则合并为数组 $string = "Hello World love Shanghai"; $arr = explode(" ", $pizza); print_r($arr);
implode( ) function returns a string composed of array elements.
explode() function uses one string to split another string and returns an array composed of strings.
The above is the detailed content of How to convert php array string to array. For more information, please follow other related articles on the PHP Chinese website!