Home  >  Article  >  Backend Development  >  PHP two-dimensional array to string example_PHP tutorial

PHP two-dimensional array to string example_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:25:05855browse

Copy code The code is as follows:

function arr2str ($arr)
{
foreach ($arr as $v)
{
$v = join(",",$v); //You can use implode to convert a one-dimensional array into a comma-connected string
$temp[] = $v ;
}
$t="";
foreach($temp as $v){
$t.="'".$v."'".",";
}
$t=substr($t,0,-1);
return $t;
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825229.htmlTechArticleCopy the code The code is as follows: function arr2str ($arr) { foreach ($arr as $v) { $v = join(",",$v); //You can use implode to convert a one-dimensional array into a string connected with commas $temp[] = $v; }...
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