1--TEST--
2str_getcsv(): Testing using various arguments
3--FILE--
4<?php
5
6// string input[, string delimiter[, string enclosure[, string escape]]]
7var_dump(str_getcsv('"f", "o", ""'));
8print "-----\n";
9var_dump(str_getcsv('foo||bar', '|'));
10print "-----\n";
11var_dump(str_getcsv('foo|bar', '|'));
12print "-----\n";
13var_dump(str_getcsv('|foo|-|bar|', '-', '|'));
14print "-----\n";
15var_dump(str_getcsv('|f.|.|bar|.|-|-.|', '.', '|', '-'));
16print "-----\n";
17var_dump(str_getcsv('.foo..bar.', '.', '.', '.'));
18print "-----\n";
19var_dump(str_getcsv('.foo. .bar.', '   ', '.', '.'));
20print "-----\n";
21var_dump(str_getcsv('1foo1 1bar111', '   ', '1   ', '\  '));
22print "-----\n";
23var_dump(str_getcsv('.foo  . .  bar  .', ' ', '.', ''));
24print "-----\n";
25var_dump(str_getcsv('" "" "', ' '));
26print "-----\n";
27var_dump(str_getcsv(''));
28print "-----\n";
29
30?>
31--EXPECT--
32array(3) {
33  [0]=>
34  string(1) "f"
35  [1]=>
36  string(1) "o"
37  [2]=>
38  string(0) ""
39}
40-----
41array(3) {
42  [0]=>
43  string(3) "foo"
44  [1]=>
45  string(0) ""
46  [2]=>
47  string(3) "bar"
48}
49-----
50array(2) {
51  [0]=>
52  string(3) "foo"
53  [1]=>
54  string(3) "bar"
55}
56-----
57array(2) {
58  [0]=>
59  string(3) "foo"
60  [1]=>
61  string(3) "bar"
62}
63-----
64array(3) {
65  [0]=>
66  string(2) "f."
67  [1]=>
68  string(3) "bar"
69  [2]=>
70  string(4) "-|-."
71}
72-----
73array(1) {
74  [0]=>
75  string(7) "foo.bar"
76}
77-----
78array(2) {
79  [0]=>
80  string(3) "foo"
81  [1]=>
82  string(3) "bar"
83}
84-----
85array(2) {
86  [0]=>
87  string(3) "foo"
88  [1]=>
89  string(4) "bar1"
90}
91-----
92array(2) {
93  [0]=>
94  string(5) "foo  "
95  [1]=>
96  string(7) "  bar  "
97}
98-----
99array(1) {
100  [0]=>
101  string(3) " " "
102}
103-----
104array(1) {
105  [0]=>
106  NULL
107}
108-----
109