1--TEST--
2Test fgetcsv() : usage variations - with all parameters specified
3--FILE--
4<?php
5/*
6 Description: Gets line from file pointer and parse for CSV fields
7*/
8
9/* Testing fgetcsv() to read a file when all its parameters are provided */
10
11echo "*** Testing fgetcsv() : with all parameters specified ***\n";
12
13/* the array is with three elements in it. Each element should be read as
14   1st element is delimiter, 2nd element is enclosure
15   and 3rd element is csv fields
16*/
17$csv_lists = array (
18  array(',', '"', '"water",fruit'),
19  array(',', '"', '"water","fruit"'),
20  array(' ', '^', '^water^ ^fruit^'),
21  array(':', '&', '&water&:&fruit&'),
22  array('=', '=', '=water===fruit='),
23  array('-', '-', '-water--fruit-air'),
24  array('-', '-', '-water---fruit---air-'),
25  array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
26);
27
28$filename = __DIR__ . '/fgetcsv_variation1.tmp';
29@unlink($filename);
30
31$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
32                     "a+", "a+b", "a+t",
33                     "w+", "w+b", "w+t",
34                     "x+", "x+b", "x+t");
35
36$loop_counter = 1;
37foreach ($csv_lists as $csv_list) {
38  for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
39    // create the file and add the content with has csv fields
40    if ( strstr($file_modes[$mode_counter], "r") ) {
41      $file_handle = fopen($filename, "w");
42    } else {
43      $file_handle = fopen($filename, $file_modes[$mode_counter] );
44    }
45    if ( !$file_handle ) {
46      echo "Error: failed to create file $filename!\n";
47      exit();
48    }
49    $delimiter = $csv_list[0];
50    $enclosure = $csv_list[1];
51    $csv_field = $csv_list[2];
52
53    fwrite($file_handle, $csv_field . "\n");
54    // write another line of text and a blank line
55    // this will be used to test, if the fgetcsv() read more than a line and its
56    // working when only a blank line is read
57    fwrite($file_handle, "This is line of text without csv fields\n");
58    fwrite($file_handle, "\n"); // blank line
59
60    // close the file if the mode to be used is read mode  and re-open using read mode
61    // else rewind the file pointer to beginning of the file
62    if ( strstr($file_modes[$mode_counter], "r" ) ) {
63      fclose($file_handle);
64      $file_handle = fopen($filename, $file_modes[$mode_counter]);
65    } else {
66      // rewind the file pointer to bof
67      rewind($file_handle);
68    }
69
70    echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
71
72    // call fgetcsv() to parse csv fields
73
74    // use the right delimiter and enclosure with max length
75    var_dump( fgetcsv($file_handle, 1024, $delimiter, $enclosure, escape: "\\") );
76    // check the file pointer position and if eof
77    var_dump( ftell($file_handle) );
78    var_dump( feof($file_handle) );
79
80    // close the file
81    fclose($file_handle);
82    //delete file
83    unlink($filename);
84  } //end of mode loop
85} // end of foreach
86
87echo "Done\n";
88?>
89--EXPECT--
90*** Testing fgetcsv() : with all parameters specified ***
91
92-- Testing fgetcsv() with file opened using r mode --
93array(2) {
94  [0]=>
95  string(5) "water"
96  [1]=>
97  string(5) "fruit"
98}
99int(14)
100bool(false)
101
102-- Testing fgetcsv() with file opened using rb mode --
103array(2) {
104  [0]=>
105  string(5) "water"
106  [1]=>
107  string(5) "fruit"
108}
109int(14)
110bool(false)
111
112-- Testing fgetcsv() with file opened using rt mode --
113array(2) {
114  [0]=>
115  string(5) "water"
116  [1]=>
117  string(5) "fruit"
118}
119int(14)
120bool(false)
121
122-- Testing fgetcsv() with file opened using r+ mode --
123array(2) {
124  [0]=>
125  string(5) "water"
126  [1]=>
127  string(5) "fruit"
128}
129int(14)
130bool(false)
131
132-- Testing fgetcsv() with file opened using r+b mode --
133array(2) {
134  [0]=>
135  string(5) "water"
136  [1]=>
137  string(5) "fruit"
138}
139int(14)
140bool(false)
141
142-- Testing fgetcsv() with file opened using r+t mode --
143array(2) {
144  [0]=>
145  string(5) "water"
146  [1]=>
147  string(5) "fruit"
148}
149int(14)
150bool(false)
151
152-- Testing fgetcsv() with file opened using a+ mode --
153array(2) {
154  [0]=>
155  string(5) "water"
156  [1]=>
157  string(5) "fruit"
158}
159int(14)
160bool(false)
161
162-- Testing fgetcsv() with file opened using a+b mode --
163array(2) {
164  [0]=>
165  string(5) "water"
166  [1]=>
167  string(5) "fruit"
168}
169int(14)
170bool(false)
171
172-- Testing fgetcsv() with file opened using a+t mode --
173array(2) {
174  [0]=>
175  string(5) "water"
176  [1]=>
177  string(5) "fruit"
178}
179int(14)
180bool(false)
181
182-- Testing fgetcsv() with file opened using w+ mode --
183array(2) {
184  [0]=>
185  string(5) "water"
186  [1]=>
187  string(5) "fruit"
188}
189int(14)
190bool(false)
191
192-- Testing fgetcsv() with file opened using w+b mode --
193array(2) {
194  [0]=>
195  string(5) "water"
196  [1]=>
197  string(5) "fruit"
198}
199int(14)
200bool(false)
201
202-- Testing fgetcsv() with file opened using w+t mode --
203array(2) {
204  [0]=>
205  string(5) "water"
206  [1]=>
207  string(5) "fruit"
208}
209int(14)
210bool(false)
211
212-- Testing fgetcsv() with file opened using x+ mode --
213array(2) {
214  [0]=>
215  string(5) "water"
216  [1]=>
217  string(5) "fruit"
218}
219int(14)
220bool(false)
221
222-- Testing fgetcsv() with file opened using x+b mode --
223array(2) {
224  [0]=>
225  string(5) "water"
226  [1]=>
227  string(5) "fruit"
228}
229int(14)
230bool(false)
231
232-- Testing fgetcsv() with file opened using x+t mode --
233array(2) {
234  [0]=>
235  string(5) "water"
236  [1]=>
237  string(5) "fruit"
238}
239int(14)
240bool(false)
241
242-- Testing fgetcsv() with file opened using r mode --
243array(2) {
244  [0]=>
245  string(5) "water"
246  [1]=>
247  string(5) "fruit"
248}
249int(16)
250bool(false)
251
252-- Testing fgetcsv() with file opened using rb mode --
253array(2) {
254  [0]=>
255  string(5) "water"
256  [1]=>
257  string(5) "fruit"
258}
259int(16)
260bool(false)
261
262-- Testing fgetcsv() with file opened using rt mode --
263array(2) {
264  [0]=>
265  string(5) "water"
266  [1]=>
267  string(5) "fruit"
268}
269int(16)
270bool(false)
271
272-- Testing fgetcsv() with file opened using r+ mode --
273array(2) {
274  [0]=>
275  string(5) "water"
276  [1]=>
277  string(5) "fruit"
278}
279int(16)
280bool(false)
281
282-- Testing fgetcsv() with file opened using r+b mode --
283array(2) {
284  [0]=>
285  string(5) "water"
286  [1]=>
287  string(5) "fruit"
288}
289int(16)
290bool(false)
291
292-- Testing fgetcsv() with file opened using r+t mode --
293array(2) {
294  [0]=>
295  string(5) "water"
296  [1]=>
297  string(5) "fruit"
298}
299int(16)
300bool(false)
301
302-- Testing fgetcsv() with file opened using a+ mode --
303array(2) {
304  [0]=>
305  string(5) "water"
306  [1]=>
307  string(5) "fruit"
308}
309int(16)
310bool(false)
311
312-- Testing fgetcsv() with file opened using a+b mode --
313array(2) {
314  [0]=>
315  string(5) "water"
316  [1]=>
317  string(5) "fruit"
318}
319int(16)
320bool(false)
321
322-- Testing fgetcsv() with file opened using a+t mode --
323array(2) {
324  [0]=>
325  string(5) "water"
326  [1]=>
327  string(5) "fruit"
328}
329int(16)
330bool(false)
331
332-- Testing fgetcsv() with file opened using w+ mode --
333array(2) {
334  [0]=>
335  string(5) "water"
336  [1]=>
337  string(5) "fruit"
338}
339int(16)
340bool(false)
341
342-- Testing fgetcsv() with file opened using w+b mode --
343array(2) {
344  [0]=>
345  string(5) "water"
346  [1]=>
347  string(5) "fruit"
348}
349int(16)
350bool(false)
351
352-- Testing fgetcsv() with file opened using w+t mode --
353array(2) {
354  [0]=>
355  string(5) "water"
356  [1]=>
357  string(5) "fruit"
358}
359int(16)
360bool(false)
361
362-- Testing fgetcsv() with file opened using x+ mode --
363array(2) {
364  [0]=>
365  string(5) "water"
366  [1]=>
367  string(5) "fruit"
368}
369int(16)
370bool(false)
371
372-- Testing fgetcsv() with file opened using x+b mode --
373array(2) {
374  [0]=>
375  string(5) "water"
376  [1]=>
377  string(5) "fruit"
378}
379int(16)
380bool(false)
381
382-- Testing fgetcsv() with file opened using x+t mode --
383array(2) {
384  [0]=>
385  string(5) "water"
386  [1]=>
387  string(5) "fruit"
388}
389int(16)
390bool(false)
391
392-- Testing fgetcsv() with file opened using r mode --
393array(2) {
394  [0]=>
395  string(5) "water"
396  [1]=>
397  string(5) "fruit"
398}
399int(16)
400bool(false)
401
402-- Testing fgetcsv() with file opened using rb mode --
403array(2) {
404  [0]=>
405  string(5) "water"
406  [1]=>
407  string(5) "fruit"
408}
409int(16)
410bool(false)
411
412-- Testing fgetcsv() with file opened using rt mode --
413array(2) {
414  [0]=>
415  string(5) "water"
416  [1]=>
417  string(5) "fruit"
418}
419int(16)
420bool(false)
421
422-- Testing fgetcsv() with file opened using r+ mode --
423array(2) {
424  [0]=>
425  string(5) "water"
426  [1]=>
427  string(5) "fruit"
428}
429int(16)
430bool(false)
431
432-- Testing fgetcsv() with file opened using r+b mode --
433array(2) {
434  [0]=>
435  string(5) "water"
436  [1]=>
437  string(5) "fruit"
438}
439int(16)
440bool(false)
441
442-- Testing fgetcsv() with file opened using r+t mode --
443array(2) {
444  [0]=>
445  string(5) "water"
446  [1]=>
447  string(5) "fruit"
448}
449int(16)
450bool(false)
451
452-- Testing fgetcsv() with file opened using a+ mode --
453array(2) {
454  [0]=>
455  string(5) "water"
456  [1]=>
457  string(5) "fruit"
458}
459int(16)
460bool(false)
461
462-- Testing fgetcsv() with file opened using a+b mode --
463array(2) {
464  [0]=>
465  string(5) "water"
466  [1]=>
467  string(5) "fruit"
468}
469int(16)
470bool(false)
471
472-- Testing fgetcsv() with file opened using a+t mode --
473array(2) {
474  [0]=>
475  string(5) "water"
476  [1]=>
477  string(5) "fruit"
478}
479int(16)
480bool(false)
481
482-- Testing fgetcsv() with file opened using w+ mode --
483array(2) {
484  [0]=>
485  string(5) "water"
486  [1]=>
487  string(5) "fruit"
488}
489int(16)
490bool(false)
491
492-- Testing fgetcsv() with file opened using w+b mode --
493array(2) {
494  [0]=>
495  string(5) "water"
496  [1]=>
497  string(5) "fruit"
498}
499int(16)
500bool(false)
501
502-- Testing fgetcsv() with file opened using w+t mode --
503array(2) {
504  [0]=>
505  string(5) "water"
506  [1]=>
507  string(5) "fruit"
508}
509int(16)
510bool(false)
511
512-- Testing fgetcsv() with file opened using x+ mode --
513array(2) {
514  [0]=>
515  string(5) "water"
516  [1]=>
517  string(5) "fruit"
518}
519int(16)
520bool(false)
521
522-- Testing fgetcsv() with file opened using x+b mode --
523array(2) {
524  [0]=>
525  string(5) "water"
526  [1]=>
527  string(5) "fruit"
528}
529int(16)
530bool(false)
531
532-- Testing fgetcsv() with file opened using x+t mode --
533array(2) {
534  [0]=>
535  string(5) "water"
536  [1]=>
537  string(5) "fruit"
538}
539int(16)
540bool(false)
541
542-- Testing fgetcsv() with file opened using r mode --
543array(2) {
544  [0]=>
545  string(5) "water"
546  [1]=>
547  string(5) "fruit"
548}
549int(16)
550bool(false)
551
552-- Testing fgetcsv() with file opened using rb mode --
553array(2) {
554  [0]=>
555  string(5) "water"
556  [1]=>
557  string(5) "fruit"
558}
559int(16)
560bool(false)
561
562-- Testing fgetcsv() with file opened using rt mode --
563array(2) {
564  [0]=>
565  string(5) "water"
566  [1]=>
567  string(5) "fruit"
568}
569int(16)
570bool(false)
571
572-- Testing fgetcsv() with file opened using r+ mode --
573array(2) {
574  [0]=>
575  string(5) "water"
576  [1]=>
577  string(5) "fruit"
578}
579int(16)
580bool(false)
581
582-- Testing fgetcsv() with file opened using r+b mode --
583array(2) {
584  [0]=>
585  string(5) "water"
586  [1]=>
587  string(5) "fruit"
588}
589int(16)
590bool(false)
591
592-- Testing fgetcsv() with file opened using r+t mode --
593array(2) {
594  [0]=>
595  string(5) "water"
596  [1]=>
597  string(5) "fruit"
598}
599int(16)
600bool(false)
601
602-- Testing fgetcsv() with file opened using a+ mode --
603array(2) {
604  [0]=>
605  string(5) "water"
606  [1]=>
607  string(5) "fruit"
608}
609int(16)
610bool(false)
611
612-- Testing fgetcsv() with file opened using a+b mode --
613array(2) {
614  [0]=>
615  string(5) "water"
616  [1]=>
617  string(5) "fruit"
618}
619int(16)
620bool(false)
621
622-- Testing fgetcsv() with file opened using a+t mode --
623array(2) {
624  [0]=>
625  string(5) "water"
626  [1]=>
627  string(5) "fruit"
628}
629int(16)
630bool(false)
631
632-- Testing fgetcsv() with file opened using w+ mode --
633array(2) {
634  [0]=>
635  string(5) "water"
636  [1]=>
637  string(5) "fruit"
638}
639int(16)
640bool(false)
641
642-- Testing fgetcsv() with file opened using w+b mode --
643array(2) {
644  [0]=>
645  string(5) "water"
646  [1]=>
647  string(5) "fruit"
648}
649int(16)
650bool(false)
651
652-- Testing fgetcsv() with file opened using w+t mode --
653array(2) {
654  [0]=>
655  string(5) "water"
656  [1]=>
657  string(5) "fruit"
658}
659int(16)
660bool(false)
661
662-- Testing fgetcsv() with file opened using x+ mode --
663array(2) {
664  [0]=>
665  string(5) "water"
666  [1]=>
667  string(5) "fruit"
668}
669int(16)
670bool(false)
671
672-- Testing fgetcsv() with file opened using x+b mode --
673array(2) {
674  [0]=>
675  string(5) "water"
676  [1]=>
677  string(5) "fruit"
678}
679int(16)
680bool(false)
681
682-- Testing fgetcsv() with file opened using x+t mode --
683array(2) {
684  [0]=>
685  string(5) "water"
686  [1]=>
687  string(5) "fruit"
688}
689int(16)
690bool(false)
691
692-- Testing fgetcsv() with file opened using r mode --
693array(2) {
694  [0]=>
695  string(11) "water=fruit"
696  [1]=>
697  string(0) ""
698}
699int(16)
700bool(false)
701
702-- Testing fgetcsv() with file opened using rb mode --
703array(2) {
704  [0]=>
705  string(11) "water=fruit"
706  [1]=>
707  string(0) ""
708}
709int(16)
710bool(false)
711
712-- Testing fgetcsv() with file opened using rt mode --
713array(2) {
714  [0]=>
715  string(11) "water=fruit"
716  [1]=>
717  string(0) ""
718}
719int(16)
720bool(false)
721
722-- Testing fgetcsv() with file opened using r+ mode --
723array(2) {
724  [0]=>
725  string(11) "water=fruit"
726  [1]=>
727  string(0) ""
728}
729int(16)
730bool(false)
731
732-- Testing fgetcsv() with file opened using r+b mode --
733array(2) {
734  [0]=>
735  string(11) "water=fruit"
736  [1]=>
737  string(0) ""
738}
739int(16)
740bool(false)
741
742-- Testing fgetcsv() with file opened using r+t mode --
743array(2) {
744  [0]=>
745  string(11) "water=fruit"
746  [1]=>
747  string(0) ""
748}
749int(16)
750bool(false)
751
752-- Testing fgetcsv() with file opened using a+ mode --
753array(2) {
754  [0]=>
755  string(11) "water=fruit"
756  [1]=>
757  string(0) ""
758}
759int(16)
760bool(false)
761
762-- Testing fgetcsv() with file opened using a+b mode --
763array(2) {
764  [0]=>
765  string(11) "water=fruit"
766  [1]=>
767  string(0) ""
768}
769int(16)
770bool(false)
771
772-- Testing fgetcsv() with file opened using a+t mode --
773array(2) {
774  [0]=>
775  string(11) "water=fruit"
776  [1]=>
777  string(0) ""
778}
779int(16)
780bool(false)
781
782-- Testing fgetcsv() with file opened using w+ mode --
783array(2) {
784  [0]=>
785  string(11) "water=fruit"
786  [1]=>
787  string(0) ""
788}
789int(16)
790bool(false)
791
792-- Testing fgetcsv() with file opened using w+b mode --
793array(2) {
794  [0]=>
795  string(11) "water=fruit"
796  [1]=>
797  string(0) ""
798}
799int(16)
800bool(false)
801
802-- Testing fgetcsv() with file opened using w+t mode --
803array(2) {
804  [0]=>
805  string(11) "water=fruit"
806  [1]=>
807  string(0) ""
808}
809int(16)
810bool(false)
811
812-- Testing fgetcsv() with file opened using x+ mode --
813array(2) {
814  [0]=>
815  string(11) "water=fruit"
816  [1]=>
817  string(0) ""
818}
819int(16)
820bool(false)
821
822-- Testing fgetcsv() with file opened using x+b mode --
823array(2) {
824  [0]=>
825  string(11) "water=fruit"
826  [1]=>
827  string(0) ""
828}
829int(16)
830bool(false)
831
832-- Testing fgetcsv() with file opened using x+t mode --
833array(2) {
834  [0]=>
835  string(11) "water=fruit"
836  [1]=>
837  string(0) ""
838}
839int(16)
840bool(false)
841
842-- Testing fgetcsv() with file opened using r mode --
843array(1) {
844  [0]=>
845  string(14) "water-fruitair"
846}
847int(18)
848bool(false)
849
850-- Testing fgetcsv() with file opened using rb mode --
851array(1) {
852  [0]=>
853  string(14) "water-fruitair"
854}
855int(18)
856bool(false)
857
858-- Testing fgetcsv() with file opened using rt mode --
859array(1) {
860  [0]=>
861  string(14) "water-fruitair"
862}
863int(18)
864bool(false)
865
866-- Testing fgetcsv() with file opened using r+ mode --
867array(1) {
868  [0]=>
869  string(14) "water-fruitair"
870}
871int(18)
872bool(false)
873
874-- Testing fgetcsv() with file opened using r+b mode --
875array(1) {
876  [0]=>
877  string(14) "water-fruitair"
878}
879int(18)
880bool(false)
881
882-- Testing fgetcsv() with file opened using r+t mode --
883array(1) {
884  [0]=>
885  string(14) "water-fruitair"
886}
887int(18)
888bool(false)
889
890-- Testing fgetcsv() with file opened using a+ mode --
891array(1) {
892  [0]=>
893  string(14) "water-fruitair"
894}
895int(18)
896bool(false)
897
898-- Testing fgetcsv() with file opened using a+b mode --
899array(1) {
900  [0]=>
901  string(14) "water-fruitair"
902}
903int(18)
904bool(false)
905
906-- Testing fgetcsv() with file opened using a+t mode --
907array(1) {
908  [0]=>
909  string(14) "water-fruitair"
910}
911int(18)
912bool(false)
913
914-- Testing fgetcsv() with file opened using w+ mode --
915array(1) {
916  [0]=>
917  string(14) "water-fruitair"
918}
919int(18)
920bool(false)
921
922-- Testing fgetcsv() with file opened using w+b mode --
923array(1) {
924  [0]=>
925  string(14) "water-fruitair"
926}
927int(18)
928bool(false)
929
930-- Testing fgetcsv() with file opened using w+t mode --
931array(1) {
932  [0]=>
933  string(14) "water-fruitair"
934}
935int(18)
936bool(false)
937
938-- Testing fgetcsv() with file opened using x+ mode --
939array(1) {
940  [0]=>
941  string(14) "water-fruitair"
942}
943int(18)
944bool(false)
945
946-- Testing fgetcsv() with file opened using x+b mode --
947array(1) {
948  [0]=>
949  string(14) "water-fruitair"
950}
951int(18)
952bool(false)
953
954-- Testing fgetcsv() with file opened using x+t mode --
955array(1) {
956  [0]=>
957  string(14) "water-fruitair"
958}
959int(18)
960bool(false)
961
962-- Testing fgetcsv() with file opened using r mode --
963array(3) {
964  [0]=>
965  string(11) "water-fruit"
966  [1]=>
967  string(3) "air"
968  [2]=>
969  string(0) ""
970}
971int(22)
972bool(false)
973
974-- Testing fgetcsv() with file opened using rb mode --
975array(3) {
976  [0]=>
977  string(11) "water-fruit"
978  [1]=>
979  string(3) "air"
980  [2]=>
981  string(0) ""
982}
983int(22)
984bool(false)
985
986-- Testing fgetcsv() with file opened using rt mode --
987array(3) {
988  [0]=>
989  string(11) "water-fruit"
990  [1]=>
991  string(3) "air"
992  [2]=>
993  string(0) ""
994}
995int(22)
996bool(false)
997
998-- Testing fgetcsv() with file opened using r+ mode --
999array(3) {
1000  [0]=>
1001  string(11) "water-fruit"
1002  [1]=>
1003  string(3) "air"
1004  [2]=>
1005  string(0) ""
1006}
1007int(22)
1008bool(false)
1009
1010-- Testing fgetcsv() with file opened using r+b mode --
1011array(3) {
1012  [0]=>
1013  string(11) "water-fruit"
1014  [1]=>
1015  string(3) "air"
1016  [2]=>
1017  string(0) ""
1018}
1019int(22)
1020bool(false)
1021
1022-- Testing fgetcsv() with file opened using r+t mode --
1023array(3) {
1024  [0]=>
1025  string(11) "water-fruit"
1026  [1]=>
1027  string(3) "air"
1028  [2]=>
1029  string(0) ""
1030}
1031int(22)
1032bool(false)
1033
1034-- Testing fgetcsv() with file opened using a+ mode --
1035array(3) {
1036  [0]=>
1037  string(11) "water-fruit"
1038  [1]=>
1039  string(3) "air"
1040  [2]=>
1041  string(0) ""
1042}
1043int(22)
1044bool(false)
1045
1046-- Testing fgetcsv() with file opened using a+b mode --
1047array(3) {
1048  [0]=>
1049  string(11) "water-fruit"
1050  [1]=>
1051  string(3) "air"
1052  [2]=>
1053  string(0) ""
1054}
1055int(22)
1056bool(false)
1057
1058-- Testing fgetcsv() with file opened using a+t mode --
1059array(3) {
1060  [0]=>
1061  string(11) "water-fruit"
1062  [1]=>
1063  string(3) "air"
1064  [2]=>
1065  string(0) ""
1066}
1067int(22)
1068bool(false)
1069
1070-- Testing fgetcsv() with file opened using w+ mode --
1071array(3) {
1072  [0]=>
1073  string(11) "water-fruit"
1074  [1]=>
1075  string(3) "air"
1076  [2]=>
1077  string(0) ""
1078}
1079int(22)
1080bool(false)
1081
1082-- Testing fgetcsv() with file opened using w+b mode --
1083array(3) {
1084  [0]=>
1085  string(11) "water-fruit"
1086  [1]=>
1087  string(3) "air"
1088  [2]=>
1089  string(0) ""
1090}
1091int(22)
1092bool(false)
1093
1094-- Testing fgetcsv() with file opened using w+t mode --
1095array(3) {
1096  [0]=>
1097  string(11) "water-fruit"
1098  [1]=>
1099  string(3) "air"
1100  [2]=>
1101  string(0) ""
1102}
1103int(22)
1104bool(false)
1105
1106-- Testing fgetcsv() with file opened using x+ mode --
1107array(3) {
1108  [0]=>
1109  string(11) "water-fruit"
1110  [1]=>
1111  string(3) "air"
1112  [2]=>
1113  string(0) ""
1114}
1115int(22)
1116bool(false)
1117
1118-- Testing fgetcsv() with file opened using x+b mode --
1119array(3) {
1120  [0]=>
1121  string(11) "water-fruit"
1122  [1]=>
1123  string(3) "air"
1124  [2]=>
1125  string(0) ""
1126}
1127int(22)
1128bool(false)
1129
1130-- Testing fgetcsv() with file opened using x+t mode --
1131array(3) {
1132  [0]=>
1133  string(11) "water-fruit"
1134  [1]=>
1135  string(3) "air"
1136  [2]=>
1137  string(0) ""
1138}
1139int(22)
1140bool(false)
1141
1142-- Testing fgetcsv() with file opened using r mode --
1143array(6) {
1144  [0]=>
1145  string(4) """"""
1146  [1]=>
1147  string(1) """
1148  [2]=>
1149  string(1) ","
1150  [3]=>
1151  string(1) """
1152  [4]=>
1153  string(1) ","
1154  [5]=>
1155  string(4) ",,,,"
1156}
1157int(24)
1158bool(false)
1159
1160-- Testing fgetcsv() with file opened using rb mode --
1161array(6) {
1162  [0]=>
1163  string(4) """"""
1164  [1]=>
1165  string(1) """
1166  [2]=>
1167  string(1) ","
1168  [3]=>
1169  string(1) """
1170  [4]=>
1171  string(1) ","
1172  [5]=>
1173  string(4) ",,,,"
1174}
1175int(24)
1176bool(false)
1177
1178-- Testing fgetcsv() with file opened using rt mode --
1179array(6) {
1180  [0]=>
1181  string(4) """"""
1182  [1]=>
1183  string(1) """
1184  [2]=>
1185  string(1) ","
1186  [3]=>
1187  string(1) """
1188  [4]=>
1189  string(1) ","
1190  [5]=>
1191  string(4) ",,,,"
1192}
1193int(24)
1194bool(false)
1195
1196-- Testing fgetcsv() with file opened using r+ mode --
1197array(6) {
1198  [0]=>
1199  string(4) """"""
1200  [1]=>
1201  string(1) """
1202  [2]=>
1203  string(1) ","
1204  [3]=>
1205  string(1) """
1206  [4]=>
1207  string(1) ","
1208  [5]=>
1209  string(4) ",,,,"
1210}
1211int(24)
1212bool(false)
1213
1214-- Testing fgetcsv() with file opened using r+b mode --
1215array(6) {
1216  [0]=>
1217  string(4) """"""
1218  [1]=>
1219  string(1) """
1220  [2]=>
1221  string(1) ","
1222  [3]=>
1223  string(1) """
1224  [4]=>
1225  string(1) ","
1226  [5]=>
1227  string(4) ",,,,"
1228}
1229int(24)
1230bool(false)
1231
1232-- Testing fgetcsv() with file opened using r+t mode --
1233array(6) {
1234  [0]=>
1235  string(4) """"""
1236  [1]=>
1237  string(1) """
1238  [2]=>
1239  string(1) ","
1240  [3]=>
1241  string(1) """
1242  [4]=>
1243  string(1) ","
1244  [5]=>
1245  string(4) ",,,,"
1246}
1247int(24)
1248bool(false)
1249
1250-- Testing fgetcsv() with file opened using a+ mode --
1251array(6) {
1252  [0]=>
1253  string(4) """"""
1254  [1]=>
1255  string(1) """
1256  [2]=>
1257  string(1) ","
1258  [3]=>
1259  string(1) """
1260  [4]=>
1261  string(1) ","
1262  [5]=>
1263  string(4) ",,,,"
1264}
1265int(24)
1266bool(false)
1267
1268-- Testing fgetcsv() with file opened using a+b mode --
1269array(6) {
1270  [0]=>
1271  string(4) """"""
1272  [1]=>
1273  string(1) """
1274  [2]=>
1275  string(1) ","
1276  [3]=>
1277  string(1) """
1278  [4]=>
1279  string(1) ","
1280  [5]=>
1281  string(4) ",,,,"
1282}
1283int(24)
1284bool(false)
1285
1286-- Testing fgetcsv() with file opened using a+t mode --
1287array(6) {
1288  [0]=>
1289  string(4) """"""
1290  [1]=>
1291  string(1) """
1292  [2]=>
1293  string(1) ","
1294  [3]=>
1295  string(1) """
1296  [4]=>
1297  string(1) ","
1298  [5]=>
1299  string(4) ",,,,"
1300}
1301int(24)
1302bool(false)
1303
1304-- Testing fgetcsv() with file opened using w+ mode --
1305array(6) {
1306  [0]=>
1307  string(4) """"""
1308  [1]=>
1309  string(1) """
1310  [2]=>
1311  string(1) ","
1312  [3]=>
1313  string(1) """
1314  [4]=>
1315  string(1) ","
1316  [5]=>
1317  string(4) ",,,,"
1318}
1319int(24)
1320bool(false)
1321
1322-- Testing fgetcsv() with file opened using w+b mode --
1323array(6) {
1324  [0]=>
1325  string(4) """"""
1326  [1]=>
1327  string(1) """
1328  [2]=>
1329  string(1) ","
1330  [3]=>
1331  string(1) """
1332  [4]=>
1333  string(1) ","
1334  [5]=>
1335  string(4) ",,,,"
1336}
1337int(24)
1338bool(false)
1339
1340-- Testing fgetcsv() with file opened using w+t mode --
1341array(6) {
1342  [0]=>
1343  string(4) """"""
1344  [1]=>
1345  string(1) """
1346  [2]=>
1347  string(1) ","
1348  [3]=>
1349  string(1) """
1350  [4]=>
1351  string(1) ","
1352  [5]=>
1353  string(4) ",,,,"
1354}
1355int(24)
1356bool(false)
1357
1358-- Testing fgetcsv() with file opened using x+ mode --
1359array(6) {
1360  [0]=>
1361  string(4) """"""
1362  [1]=>
1363  string(1) """
1364  [2]=>
1365  string(1) ","
1366  [3]=>
1367  string(1) """
1368  [4]=>
1369  string(1) ","
1370  [5]=>
1371  string(4) ",,,,"
1372}
1373int(24)
1374bool(false)
1375
1376-- Testing fgetcsv() with file opened using x+b mode --
1377array(6) {
1378  [0]=>
1379  string(4) """"""
1380  [1]=>
1381  string(1) """
1382  [2]=>
1383  string(1) ","
1384  [3]=>
1385  string(1) """
1386  [4]=>
1387  string(1) ","
1388  [5]=>
1389  string(4) ",,,,"
1390}
1391int(24)
1392bool(false)
1393
1394-- Testing fgetcsv() with file opened using x+t mode --
1395array(6) {
1396  [0]=>
1397  string(4) """"""
1398  [1]=>
1399  string(1) """
1400  [2]=>
1401  string(1) ","
1402  [3]=>
1403  string(1) """
1404  [4]=>
1405  string(1) ","
1406  [5]=>
1407  string(4) ",,,,"
1408}
1409int(24)
1410bool(false)
1411Done
1412