PHP string to array and array to string

不言
Release: 2023-03-23 12:58:01
Original
1909 people have browsed it

The content of this article is to share with you PHP string to array and array to string. Friends in need can refer to it


//数组按指定方式分割为字符串
$arr = array('Hello','World!','I','love','Shanghai!');
    
echo implode(" ",$arr);

//字符串按指定规则合并为数组
$string = "Hello World love Shanghai";

$arr = explode(" ", $pizza);

print_r($arr);
Copy after login

Related recommendations:

php character encoding conversion

Detailed explanation of the difference between three PHP string delimiters

php string usage Detailed explanation


The above is the detailed content of PHP string to array and array to string. 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