PHP array and string related functions

不言
Release: 2023-03-25 18:02:02
Original
1504 people have browsed it

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);
Copy after login

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template