Home > 类库下载 > PHP类库 > Conversion between arrays and strings in php

Conversion between arrays and strings in php

高洛峰
Release: 2016-10-19 10:03:12
Original
1225 people have browsed it

Convert array to string:

implode('!', $arr);//Convert one-dimensional array to ! Separate and combine into a string, parameter one can be ""

Convert string to array:

explode('!', $str);//Split the string into a one-dimensional array with !, parameter Number one cannot be ""

str_split($str, 3);//Split the string into an array. Parameter two splits the string every 3 characters from left to right. How many characters are there if the last one is not enough? Count how many.


Related labels:
php
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template