php把二维数组转化为字符串

function arr2str ($arr)
{
    foreach ($arr as $v)
    {
        $v = join(",",$v); //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
        $temp[] = $v;
    }
    $t="";
    foreach($temp as $v){
        $t.="'".$v."'".",";
    }
    $t=substr($t,0,-1);
    return $t;
}

你可能感兴趣的:(php把二维数组转化为字符串)