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

PHP two-dimensional array converted to string example

WBOY
Release: 2016-07-25 08:54:16
Original
2028 people have browsed it
  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


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