Home  >  Article  >  Backend Development  >  PHP two-dimensional array converted to string example

PHP two-dimensional array converted to string example

WBOY
WBOYOriginal
2016-07-25 08:54:161977browse
  1. function arr2str ($arr)
  2. {
  3. foreach ($arr as $v)
  4. {
  5. $v = join(",",$v); //You can use implode to Dimensional array converted to string concatenated with commas
  6. $temp[] = $v;
  7. }
  8. $t="";
  9. foreach($temp as $v){
  10. $t.="'".$v. "'".",";
  11. }
  12. $t=substr($t,0,-1);
  13. return $t;
  14. }
Copy code


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