PHP Classes

File: test/test_tsv_string.php

Recommend this page to a friend!
  Classes of Ionut-Alexandru Toma   PHP Export Data   test/test_tsv_string.php   Download  
File: test/test_tsv_string.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Export Data
Export data in CSV, TSV, or Excel XML formats
Author: By
Last change:
Date: 7 years ago
Size: 544 bytes
 

Contents

Class file image Download
<?php

// Shows how exporting to string works.
// This isn't a good way to export very large datasets, since all the exported data must be kept in memory

require "../php-export-data.class.php";

$tsv = new ExportDataTSV('string');
$tsv->filename = "test.xls";

$data = array(
    array(
1,2,3),
    array(
"asdf","jkl","semi"),
    array(
"1273623874628374634876","=asdf","10-10"),
);
$tsv->initialize();
foreach(
$data as $row) {
   
$tsv->addRow($row);
}
$tsv->finalize();

$exportedData = $tsv->getString();

print
$exportedData;