forked from nuovo/spreadsheet-reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
53 lines (45 loc) · 1.12 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* XLS parsing uses php-excel-reader from http://code.google.com/p/php-excel-reader/
*/
if (isset($argv[1]))
{
$Filepath = $argv[1];
}
else
{
echo 'Please specify filename as the first argument'.PHP_EOL;
exit;
}
// Excel reader from http://code.google.com/p/php-excel-reader/
require('php-excel-reader/excel_reader2.php');
require('SpreadsheetReader.php');
date_default_timezone_set('UTC');
$Spreadsheet = new SpreadsheetReader($Filepath);
$BaseMem = memory_get_usage();
$Time = microtime(true);
foreach ($Spreadsheet as $Key => $Row)
{
echo $Key.': ';
if ($Row)
{
print_r($Row);
}
else
{
var_dump($Row);
}
$CurrentMem = memory_get_usage();
echo ($CurrentMem - $BaseMem).' current, '.$CurrentMem.' base'.PHP_EOL;
echo '---------------------------------'.PHP_EOL;
if ($Key && ($Key % 500 == 0))
{
echo '---------------------------------'.PHP_EOL;
echo 'Time: '.(microtime(true) - $Time);
echo '---------------------------------'.PHP_EOL;
}
}
echo PHP_EOL.'---------------------------------'.PHP_EOL;
echo 'Time: '.(microtime(true) - $Time);
echo PHP_EOL;
?>