/* Converting a two-dimensional array to a string is actually very simple. Use a for loop to correct the two-dimensional array $arr you read, such as Array ( [0] = > Array ( [name] => Industry) [1] => Array ( [name] => Forum) ) Code Start */$sum = 0; $count = count($arr);for($ i = 0; $i < $count; $i++){ $sum .= $arr[$i][‘name’];}$sum = substr($sum,1);echo ($sum);
+7Votes
One-dimensional arrays are converted to string code!
<?php
$arr1=array(“shu”,”zhu”,”1″);
$c=implode(“
+3Votes
“,$arr1);
echo $ c; //shu
+2Votes
zhu
+8Votes
1
?>
Two-dimensional array converted to string code
<?php
$arr=array(array(“hu” ,”peng”,”123456″));
$b=implode(“
+4Votes
“,$arr[0]);
echo $b; //hu
+6Votes
peng
+3Votes
123456?>
+2Votes
/* Converting a two-dimensional array to a string is actually very simple. Use a for loop to correct the two-dimensional array $arr you read, such as Array ( [0] = > Array ( [name] => Industry) [1] => Array ( [name] => Forum) ) Code Start */$sum = 0; $count = count($arr);for($ i = 0; $i < $count; $i++){ $sum .= $arr[$i][‘name’];}$sum = substr($sum,1);echo ($sum);