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