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(NULL));
28print "-----\n";
29var_dump(str_getcsv(''));
30print "-----\n";
31
32?>
33--EXPECT--
34array(3) {
35  [0]=>
36  string(1) "f"
37  [1]=>
38  string(1) "o"
39  [2]=>
40  string(0) ""
41}
42-----
43array(3) {
44  [0]=>
45  string(3) "foo"
46  [1]=>
47  string(0) ""
48  [2]=>
49  string(3) "bar"
50}
51-----
52array(2) {
53  [0]=>
54  string(3) "foo"
55  [1]=>
56  string(3) "bar"
57}
58-----
59array(2) {
60  [0]=>
61  string(3) "foo"
62  [1]=>
63  string(3) "bar"
64}
65-----
66array(3) {
67  [0]=>
68  string(2) "f."
69  [1]=>
70  string(3) "bar"
71  [2]=>
72  string(4) "-|-."
73}
74-----
75array(1) {
76  [0]=>
77  string(7) "foo.bar"
78}
79-----
80array(2) {
81  [0]=>
82  string(3) "foo"
83  [1]=>
84  string(3) "bar"
85}
86-----
87array(2) {
88  [0]=>
89  string(3) "foo"
90  [1]=>
91  string(4) "bar1"
92}
93-----
94array(2) {
95  [0]=>
96  string(5) "foo  "
97  [1]=>
98  string(7) "  bar  "
99}
100-----
101array(1) {
102  [0]=>
103  string(3) " " "
104}
105-----
106array(1) {
107  [0]=>
108  NULL
109}
110-----
111array(1) {
112  [0]=>
113  NULL
114}
115-----
116