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 018: Various different lines.
3
--FILE--
4
<?php
5
// $Id: 018.phpt,v 1.2 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 defines the config up front
10
 *   i.e. no discoverFormat and it removes the sep after the double
11
 *   quote
12
 * data gotten from http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm
13
 */
14
 
15
require_once 'File/CSV.php';
16
 
17
$file = dirname(__FILE__) . '/018.csv';
18
$conf = array(
19
    'fields' => 6,
20
    'sep' => ',',
21
    'quote' => '"'
22
);
23
 
24
$data = array();
25
while ($res = File_CSV::read($file, $conf)) {
26
    $data[] = $res;
27
}
28
 
29
print "Data:\n";
30
print_r($data);
31
print "\n";
32
?>
33
--EXPECT--
34
Data:
35
Array
36
(
37
    [0] => Array
38
        (
39
            [0] => Joan "the bone" Anne
40
            [1] => Jet
41
            [2] => 9th, at Terrace plc
42
            [3] => Desert City
43
            [4] => CO
44
            [5] => 00123
45
        )
46
 
47
)