首页 >后端开发 >php教程 >php二维数组转换为字符串示例

php二维数组转换为字符串示例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-07-25 08:54:162038浏览
  1. function arr2str ($arr)
  2. {
  3. foreach ($arr as $v)
  4. {
  5. $v = join(",",$v); //可以用implode将一维数组转换为用逗号连接的字符串
  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. }
复制代码


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn