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