summaryrefslogtreecommitdiff
path: root/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt
blob: c6da6b3d48969af257369a2a230848ccb435a59b (plain)
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
--TEST--
SPL: SplFileObject::setCsvControl variation 001
--CREDITS--
Erwin Poeze <erwin.poeze at gmail.com>
--FILE--
<?php
file_put_contents('csv_control_data.csv',
<<<CDATA
"groene appelen",10
"gele bananen",20
"rode kersen",30
CDATA
);
$s = new SplFileObject('csv_control_data.csv');
$s->setFlags(SplFileObject::READ_CSV);
$s->setCsvControl();
foreach ($s as $row) {
    list($fruit, $quantity) = $row;
    echo "$fruit : $quantity\n";
}
?>
--CLEAN--
<?php
unlink('csv_control_data.csv');
?>
--EXPECT--
groene appelen : 10
gele bananen : 20
rode kersen : 30