Home >Backend Development >PHP Tutorial >PHP array and string related functions
This article mainly introduces the functions related to PHP arrays and strings. It has certain reference value. Now I share it with you. Friends in need can refer to it
1 explode(" delimiter", string) splits the string according to the delimiter and returns an array.
$str ="1,2,3,4,5,6,7,8,9"; $new_arr = explode(',',$str); var_dump($new_arr);
2 implode("connector",$array name); Use the connector to connect the array elements in the array and return a string.
$arr =[]; $arr[] =1; $arr[] =2; $arr[] =3; $arr[] =4; $arr[] =5; $arr[] =6; $str = implode(',',$arr);var_dump($str);
The above is the entire content of this article. For more related content, please pay attention to the PHP Chinese website.
Related recommendations:
PHP array sorting function array_multisort() function detailed explanation
##
The above is the detailed content of PHP array and string related functions. For more information, please follow other related articles on the PHP Chinese website!