Imploding an Array : Explode implode « Development « PHP






Imploding an Array

<html>
<head>
<title>Implode</title>
</head>
<body>
<?php
     $contact_data = Array();
   
     $contact_data[0][0] = "W";
     $contact_data[0][1] = "W";
     $contact_data[0][2] = "W";
     $contact_data[0][3] = ".";
     $contact_data[0][4] = "J";
     $contact_data[0][5] = "A";
     $contact_data[0][6] = "V";
     $contact_data[0][7] = "A";
     $contact_data[1][0] = 2;
     $contact_data[1][1] = "S";
     $contact_data[1][2] = ".";
     $contact_data[1][3] = "C";
     $contact_data[1][4] = "O";
     $contact_data[1][5] = "M";
     $contact_data[1][6] = 9;
     $contact_data[1][7] = "";
     $contact_data[2][0] = "A";
     $contact_data[2][1] = "";
     $contact_data[2][2] = "B";
     $contact_data[2][3] = "C";
     $contact_data[2][4] = "D";
     $contact_data[2][5] = "E";
     $contact_data[2][6] = 5;
     $contact_data[2][7] = "5.555.5";
   
     $str_export_data = "";
   
     for($i = 0; $i < count($contact_data); $i++)
          $str_export_data .= implode(",", $contact_data[$i]) . "\n";
   
     print(str_replace("\n", "\n<br />", $str_export_data));
?>
</body>
</html>
           
       








Related examples in the same category

1.Set Implode char
2.explode time
3.Implode array elements
4.Takes a string apart based on a delimiter