Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
File_CSV Test Case 027: Records with spaces around them but no quotes
3
--FILE--
4
<?php
5
// $Id: 027.phpt,v 1.2 2007/05/11 21:49:01 cipri Exp $
6
/**
7
 * data gotten from http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm
8
 */
9
 
10
require_once 'File/CSV.php';
11
 
12
$file = dirname(__FILE__) . '/027.csv';
13
$conf = File_CSV::discoverFormat($file);
14
 
15
print "Format:\n";
16
echo 'fields: ' . $conf['fields'] . "\n";
17
echo "sep:\n";
18
File_CSV::_dbgBuff($conf['sep']);
19
echo "quote:\n";
20
File_CSV::_dbgBuff($conf['quote']);
21
print "\n";
22
$data = array();
23
while ($res = File_CSV::read($file, $conf)) {
24
    $data[] = $res;
25
}
26
 
27
print "Data:\n";
28
print_r($data);
29
print "\n";
30
?>
31
--EXPECT--
32
Format:
33
fields: 3
34
sep:
35
buff: (,)
36
quote:
37
buff: (_NULL_)
38
 
39
Data:
40
Array
41
(
42
    [0] => Array
43
        (
44
            [0] => John
45
            [1] => Doe
46
            [2] => Bob
47
        )
48
 
49
    [1] => Array
50
        (
51
            [0] => John
52
            [1] => Doe
53
            [2] => Bob
54
        )
55
 
56
)