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