Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Imploding an Array

Tue Oct 28, 2008 12:00 am

Code:
<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>




Post a reply
  Related Posts  to : Imploding an Array
 Array difference for associate array     -  
 compare an array with another array?     -  
 C++ array copying     -  
 Pad array to the specified length with a value     -  
 Array C++ Class     -  
 XML Document into an Array in php     -  
 Pop the element off the end of array     -  
 Shuffle Array     -  
 Here is how to display any 2d array     -  
 PHP Array Functions     -  

Topic Tags

PHP Arrays