Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Hannes Dorn  >  CCsv  >  index.php  >  Download  
File: index.php
Role: ???
Content type: text/plain
Description: Sample using CCsv()
Class: CCsv
Author: By
Last change:
Date: 2001-01-02 05:11
Size: 1,032 bytes
 

Contents

Class file image Download
<?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 );

?>