<?php
require( "csv.php" );
Function ArrayPrint( $aArray )
{
if ( !is_array( $aArray ) )
return;
while( list( $sKey, $sValue ) = each( $aArray ) )
if ( is_array( $sValue ) )
{
echo "$sKey=<br>\n";
ArrayPrint( $sValue );
}
else
echo "$sKey = $sValue<br>\n";
}
$oCSV = new CCsv();
$aResult = array
(
0 => array( "field1" => "value11", "field2" => "value12", "field3" => "value13", "field4" => "value14", "field5" => "value15" ),
1 => array( "field1" => "value21", "field2" => "value22", "field3" => "value23", "field4" => "value24", "field5" => "value25" ),
3 => array( "field1" => "value31", "field2" => "value32", "field3" => "value33", "field4" => "value34", "field5" => "value35" )
);
echo "<h1>Before</h1>\n";
ArrayPrint( $aResult );
$oCSV->Write( "d:/test.csv", $aResult );
unset( $aResult );
$aResult = $oCSV->Read( "d:/test.csv" );
echo "<h1>After</h1>\n";
ArrayPrint( $aResult );
?> |