Home >Backend Development >PHP Tutorial >PHP array and string related functions

PHP array and string related functions

不言
不言Original
2018-05-09 14:46:091521browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn