How to convert array to string in php

藏色散人
Release: 2023-03-04 22:46:02
Original
3195 people have browsed it

php method to convert an array to a string: first create a PHP sample file; then convert the one-dimensional array [arr1] through the [$c=implode(“##”,$arr1);] method into a string.

How to convert array to string in php

Recommended: "PHP Video Tutorial"

Convert php array into string, php implode()

Example code

Convert one-dimensional array into string code!

<?php
$arr1=array(“shu”,”zhu”,”1″);
$c=implode(“##”,$arr1);
echo $c;  //shu##zhu##1 
?>
Copy after login

Convert two-dimensional array to string code

<?php
$arr=array(array(“hu”,”peng”,”123456“));
$b=implode(“##”,$arr[0]);
echo $b; //hu##peng##123456?>
Copy after login

The above is the detailed content of How to convert array to string in php. 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