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 019: Various different lines.
3
--FILE--
4
<?php
5
// $Id: 019.phpt,v 1.3 2007/05/11 21:49:01 cipri Exp $
6
/**
7
 * Test for:
8
 * - parsing, separators and quotes within quotes
9
 * - Identical to 016 beside it removes the sep after the double
10
 *   quote
11
 * data gotten from http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm
12
 */
13
 
14
require_once 'File/CSV.php';
15
 
16
$file = dirname(__FILE__) . '/019.csv';
17
$conf = File_CSV::discoverFormat($file);
18
 
19
print "Format:\n";
20
print_r($conf);
21
print "\n";
22
 
23
$data = array();
24
while ($res = File_CSV::read($file, $conf)) {
25
    $data[] = $res;
26
}
27
 
28
print "Data:\n";
29
print_r($data);
30
print "\n";
31
?>
32
--EXPECT--
33
Format:
34
Array
35
(
36
    [fields] => 6
37
    [sep] => ,
38
    [quote] => "
39
)
40
 
41
Data:
42
Array
43
(
44
    [0] => Array
45
        (
46
            [0] => Joan "the bone" Anne
47
            [1] => Jet
48
            [2] => 9th, at Terrace plc
49
            [3] => Desert City
50
            [4] => CO
51
            [5] => 00123
52
        )
53
 
54
)