Home >Backend Development >PHP Tutorial >How to use the explode() function to split a string into an array in PHP_PHP Tutorial
This article mainly introduces how PHP uses the explode() function to split a string into an array. The method has certain reference value. Friends in need can refer to it
The example in this article describes how PHP uses the explode() function to split a string into an array. Share it with everyone for your reference. The specific analysis is as follows:
explode() function: split the string into an array
The sample code is as follows:
?
3 4
5
6
|
$str = "Chaoyang District, Haidian District, Xicheng District, Dongcheng District, Fengtai District";
$arr = explode(",",$str); "; |