Example of php converting a two dimensional array to a string

  • 2021-01-02 21:47:18
  • OfStack


function arr2str ($arr)
{
    foreach ($arr as $v)
    {
        $v = join(",",$v); // You can use implode will 1 An array of dimensions is converted to a string concatenated with commas 
        $temp[] = $v;
    }
    $t="";
    foreach($temp as $v){
        $t.="'".$v."'".",";
    }
    $t=substr($t,0,-1);
    return $t;
}


Related articles: