Return to fgetcsv_variation17.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST--
2: Test 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:
14: echo "*** 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 = dirname(__FILE__) . '/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;
36: foreach ($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
1.1.1.2 ! misho 58: // else rewind the file pointer to beginning of the file
1.1 misho 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:
91: echo "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 --
97: array(2) {
98: [0]=>
99: string(5) "water"
100: [1]=>
101: string(3) "fru"
102: }
103: int(9)
104: bool(false)
105: array(1) {
106: [0]=>
107: string(2) "it"
108: }
109: int(12)
110: bool(false)
111:
112: -- Testing fgetcsv() with file opened using rb mode --
113: array(2) {
114: [0]=>
115: string(5) "water"
116: [1]=>
117: string(3) "fru"
118: }
119: int(9)
120: bool(false)
121: array(1) {
122: [0]=>
123: string(2) "it"
124: }
125: int(12)
126: bool(false)
127:
128: -- Testing fgetcsv() with file opened using rt mode --
129: array(2) {
130: [0]=>
131: string(5) "water"
132: [1]=>
133: string(3) "fru"
134: }
135: int(9)
136: bool(false)
137: array(1) {
138: [0]=>
139: string(2) "it"
140: }
141: int(12)
142: bool(false)
143:
144: -- Testing fgetcsv() with file opened using r+ mode --
145: array(2) {
146: [0]=>
147: string(5) "water"
148: [1]=>
149: string(3) "fru"
150: }
151: int(9)
152: bool(false)
153: array(1) {
154: [0]=>
155: string(2) "it"
156: }
157: int(12)
158: bool(false)
159:
160: -- Testing fgetcsv() with file opened using r+b mode --
161: array(2) {
162: [0]=>
163: string(5) "water"
164: [1]=>
165: string(3) "fru"
166: }
167: int(9)
168: bool(false)
169: array(1) {
170: [0]=>
171: string(2) "it"
172: }
173: int(12)
174: bool(false)
175:
176: -- Testing fgetcsv() with file opened using r+t mode --
177: array(2) {
178: [0]=>
179: string(5) "water"
180: [1]=>
181: string(3) "fru"
182: }
183: int(9)
184: bool(false)
185: array(1) {
186: [0]=>
187: string(2) "it"
188: }
189: int(12)
190: bool(false)
191:
192: -- Testing fgetcsv() with file opened using a+ mode --
193: array(2) {
194: [0]=>
195: string(5) "water"
196: [1]=>
197: string(3) "fru"
198: }
199: int(9)
200: bool(false)
201: array(1) {
202: [0]=>
203: string(2) "it"
204: }
205: int(12)
206: bool(false)
207:
208: -- Testing fgetcsv() with file opened using a+b mode --
209: array(2) {
210: [0]=>
211: string(5) "water"
212: [1]=>
213: string(3) "fru"
214: }
215: int(9)
216: bool(false)
217: array(1) {
218: [0]=>
219: string(2) "it"
220: }
221: int(12)
222: bool(false)
223:
224: -- Testing fgetcsv() with file opened using a+t mode --
225: array(2) {
226: [0]=>
227: string(5) "water"
228: [1]=>
229: string(3) "fru"
230: }
231: int(9)
232: bool(false)
233: array(1) {
234: [0]=>
235: string(2) "it"
236: }
237: int(12)
238: bool(false)
239:
240: -- Testing fgetcsv() with file opened using w+ mode --
241: array(2) {
242: [0]=>
243: string(5) "water"
244: [1]=>
245: string(3) "fru"
246: }
247: int(9)
248: bool(false)
249: array(1) {
250: [0]=>
251: string(2) "it"
252: }
253: int(12)
254: bool(false)
255:
256: -- Testing fgetcsv() with file opened using w+b mode --
257: array(2) {
258: [0]=>
259: string(5) "water"
260: [1]=>
261: string(3) "fru"
262: }
263: int(9)
264: bool(false)
265: array(1) {
266: [0]=>
267: string(2) "it"
268: }
269: int(12)
270: bool(false)
271:
272: -- Testing fgetcsv() with file opened using w+t mode --
273: array(2) {
274: [0]=>
275: string(5) "water"
276: [1]=>
277: string(3) "fru"
278: }
279: int(9)
280: bool(false)
281: array(1) {
282: [0]=>
283: string(2) "it"
284: }
285: int(12)
286: bool(false)
287:
288: -- Testing fgetcsv() with file opened using x+ mode --
289: array(2) {
290: [0]=>
291: string(5) "water"
292: [1]=>
293: string(3) "fru"
294: }
295: int(9)
296: bool(false)
297: array(1) {
298: [0]=>
299: string(2) "it"
300: }
301: int(12)
302: bool(false)
303:
304: -- Testing fgetcsv() with file opened using x+b mode --
305: array(2) {
306: [0]=>
307: string(5) "water"
308: [1]=>
309: string(3) "fru"
310: }
311: int(9)
312: bool(false)
313: array(1) {
314: [0]=>
315: string(2) "it"
316: }
317: int(12)
318: bool(false)
319:
320: -- Testing fgetcsv() with file opened using x+t mode --
321: array(2) {
322: [0]=>
323: string(5) "water"
324: [1]=>
325: string(3) "fru"
326: }
327: int(9)
328: bool(false)
329: array(1) {
330: [0]=>
331: string(2) "it"
332: }
333: int(12)
334: bool(false)
335:
336: -- Testing fgetcsv() with file opened using r mode --
337: array(2) {
338: [0]=>
339: string(5) "water"
340: [1]=>
341: string(3) "fru"
342: }
343: int(9)
344: bool(false)
345: array(1) {
346: [0]=>
347: string(2) "it"
348: }
349: int(12)
350: bool(false)
351:
352: -- Testing fgetcsv() with file opened using rb mode --
353: array(2) {
354: [0]=>
355: string(5) "water"
356: [1]=>
357: string(3) "fru"
358: }
359: int(9)
360: bool(false)
361: array(1) {
362: [0]=>
363: string(2) "it"
364: }
365: int(12)
366: bool(false)
367:
368: -- Testing fgetcsv() with file opened using rt mode --
369: array(2) {
370: [0]=>
371: string(5) "water"
372: [1]=>
373: string(3) "fru"
374: }
375: int(9)
376: bool(false)
377: array(1) {
378: [0]=>
379: string(2) "it"
380: }
381: int(12)
382: bool(false)
383:
384: -- Testing fgetcsv() with file opened using r+ mode --
385: array(2) {
386: [0]=>
387: string(5) "water"
388: [1]=>
389: string(3) "fru"
390: }
391: int(9)
392: bool(false)
393: array(1) {
394: [0]=>
395: string(2) "it"
396: }
397: int(12)
398: bool(false)
399:
400: -- Testing fgetcsv() with file opened using r+b mode --
401: array(2) {
402: [0]=>
403: string(5) "water"
404: [1]=>
405: string(3) "fru"
406: }
407: int(9)
408: bool(false)
409: array(1) {
410: [0]=>
411: string(2) "it"
412: }
413: int(12)
414: bool(false)
415:
416: -- Testing fgetcsv() with file opened using r+t mode --
417: array(2) {
418: [0]=>
419: string(5) "water"
420: [1]=>
421: string(3) "fru"
422: }
423: int(9)
424: bool(false)
425: array(1) {
426: [0]=>
427: string(2) "it"
428: }
429: int(12)
430: bool(false)
431:
432: -- Testing fgetcsv() with file opened using a+ mode --
433: array(2) {
434: [0]=>
435: string(5) "water"
436: [1]=>
437: string(3) "fru"
438: }
439: int(9)
440: bool(false)
441: array(1) {
442: [0]=>
443: string(2) "it"
444: }
445: int(12)
446: bool(false)
447:
448: -- Testing fgetcsv() with file opened using a+b mode --
449: array(2) {
450: [0]=>
451: string(5) "water"
452: [1]=>
453: string(3) "fru"
454: }
455: int(9)
456: bool(false)
457: array(1) {
458: [0]=>
459: string(2) "it"
460: }
461: int(12)
462: bool(false)
463:
464: -- Testing fgetcsv() with file opened using a+t mode --
465: array(2) {
466: [0]=>
467: string(5) "water"
468: [1]=>
469: string(3) "fru"
470: }
471: int(9)
472: bool(false)
473: array(1) {
474: [0]=>
475: string(2) "it"
476: }
477: int(12)
478: bool(false)
479:
480: -- Testing fgetcsv() with file opened using w+ mode --
481: array(2) {
482: [0]=>
483: string(5) "water"
484: [1]=>
485: string(3) "fru"
486: }
487: int(9)
488: bool(false)
489: array(1) {
490: [0]=>
491: string(2) "it"
492: }
493: int(12)
494: bool(false)
495:
496: -- Testing fgetcsv() with file opened using w+b mode --
497: array(2) {
498: [0]=>
499: string(5) "water"
500: [1]=>
501: string(3) "fru"
502: }
503: int(9)
504: bool(false)
505: array(1) {
506: [0]=>
507: string(2) "it"
508: }
509: int(12)
510: bool(false)
511:
512: -- Testing fgetcsv() with file opened using w+t mode --
513: array(2) {
514: [0]=>
515: string(5) "water"
516: [1]=>
517: string(3) "fru"
518: }
519: int(9)
520: bool(false)
521: array(1) {
522: [0]=>
523: string(2) "it"
524: }
525: int(12)
526: bool(false)
527:
528: -- Testing fgetcsv() with file opened using x+ mode --
529: array(2) {
530: [0]=>
531: string(5) "water"
532: [1]=>
533: string(3) "fru"
534: }
535: int(9)
536: bool(false)
537: array(1) {
538: [0]=>
539: string(2) "it"
540: }
541: int(12)
542: bool(false)
543:
544: -- Testing fgetcsv() with file opened using x+b mode --
545: array(2) {
546: [0]=>
547: string(5) "water"
548: [1]=>
549: string(3) "fru"
550: }
551: int(9)
552: bool(false)
553: array(1) {
554: [0]=>
555: string(2) "it"
556: }
557: int(12)
558: bool(false)
559:
560: -- Testing fgetcsv() with file opened using x+t mode --
561: array(2) {
562: [0]=>
563: string(5) "water"
564: [1]=>
565: string(3) "fru"
566: }
567: int(9)
568: bool(false)
569: array(1) {
570: [0]=>
571: string(2) "it"
572: }
573: int(12)
574: bool(false)
575:
576: -- Testing fgetcsv() with file opened using r mode --
577: array(2) {
578: [0]=>
579: string(5) "water"
580: [1]=>
581: string(5) "fruit"
582: }
583: int(16)
584: bool(false)
585: array(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: }
603: int(56)
604: bool(false)
605:
606: -- Testing fgetcsv() with file opened using rb mode --
607: array(2) {
608: [0]=>
609: string(5) "water"
610: [1]=>
611: string(5) "fruit"
612: }
613: int(16)
614: bool(false)
615: array(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: }
633: int(56)
634: bool(false)
635:
636: -- Testing fgetcsv() with file opened using rt mode --
637: array(2) {
638: [0]=>
639: string(5) "water"
640: [1]=>
641: string(5) "fruit"
642: }
643: int(16)
644: bool(false)
645: array(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: }
663: int(56)
664: bool(false)
665:
666: -- Testing fgetcsv() with file opened using r+ mode --
667: array(2) {
668: [0]=>
669: string(5) "water"
670: [1]=>
671: string(5) "fruit"
672: }
673: int(16)
674: bool(false)
675: array(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: }
693: int(56)
694: bool(false)
695:
696: -- Testing fgetcsv() with file opened using r+b mode --
697: array(2) {
698: [0]=>
699: string(5) "water"
700: [1]=>
701: string(5) "fruit"
702: }
703: int(16)
704: bool(false)
705: array(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: }
723: int(56)
724: bool(false)
725:
726: -- Testing fgetcsv() with file opened using r+t mode --
727: array(2) {
728: [0]=>
729: string(5) "water"
730: [1]=>
731: string(5) "fruit"
732: }
733: int(16)
734: bool(false)
735: array(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: }
753: int(56)
754: bool(false)
755:
756: -- Testing fgetcsv() with file opened using a+ mode --
757: array(2) {
758: [0]=>
759: string(5) "water"
760: [1]=>
761: string(5) "fruit"
762: }
763: int(16)
764: bool(false)
765: array(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: }
783: int(56)
784: bool(false)
785:
786: -- Testing fgetcsv() with file opened using a+b mode --
787: array(2) {
788: [0]=>
789: string(5) "water"
790: [1]=>
791: string(5) "fruit"
792: }
793: int(16)
794: bool(false)
795: array(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: }
813: int(56)
814: bool(false)
815:
816: -- Testing fgetcsv() with file opened using a+t mode --
817: array(2) {
818: [0]=>
819: string(5) "water"
820: [1]=>
821: string(5) "fruit"
822: }
823: int(16)
824: bool(false)
825: array(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: }
843: int(56)
844: bool(false)
845:
846: -- Testing fgetcsv() with file opened using w+ mode --
847: array(2) {
848: [0]=>
849: string(5) "water"
850: [1]=>
851: string(5) "fruit"
852: }
853: int(16)
854: bool(false)
855: array(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: }
873: int(56)
874: bool(false)
875:
876: -- Testing fgetcsv() with file opened using w+b mode --
877: array(2) {
878: [0]=>
879: string(5) "water"
880: [1]=>
881: string(5) "fruit"
882: }
883: int(16)
884: bool(false)
885: array(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: }
903: int(56)
904: bool(false)
905:
906: -- Testing fgetcsv() with file opened using w+t mode --
907: array(2) {
908: [0]=>
909: string(5) "water"
910: [1]=>
911: string(5) "fruit"
912: }
913: int(16)
914: bool(false)
915: array(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: }
933: int(56)
934: bool(false)
935:
936: -- Testing fgetcsv() with file opened using x+ mode --
937: array(2) {
938: [0]=>
939: string(5) "water"
940: [1]=>
941: string(5) "fruit"
942: }
943: int(16)
944: bool(false)
945: array(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: }
963: int(56)
964: bool(false)
965:
966: -- Testing fgetcsv() with file opened using x+b mode --
967: array(2) {
968: [0]=>
969: string(5) "water"
970: [1]=>
971: string(5) "fruit"
972: }
973: int(16)
974: bool(false)
975: array(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: }
993: int(56)
994: bool(false)
995:
996: -- Testing fgetcsv() with file opened using x+t mode --
997: array(2) {
998: [0]=>
999: string(5) "water"
1000: [1]=>
1001: string(5) "fruit"
1002: }
1003: int(16)
1004: bool(false)
1005: array(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: }
1023: int(56)
1024: bool(false)
1025:
1026: -- Testing fgetcsv() with file opened using r mode --
1027: array(3) {
1028: [0]=>
1029: string(5) "water"
1030: [1]=>
1031: string(5) "fruit"
1032: [2]=>
1033: string(3) "air"
1034: }
1035: int(20)
1036: bool(false)
1037: array(1) {
1038: [0]=>
1039: string(39) "This is line of text without csv fields"
1040: }
1041: int(60)
1042: bool(false)
1043:
1044: -- Testing fgetcsv() with file opened using rb mode --
1045: array(3) {
1046: [0]=>
1047: string(5) "water"
1048: [1]=>
1049: string(5) "fruit"
1050: [2]=>
1051: string(3) "air"
1052: }
1053: int(20)
1054: bool(false)
1055: array(1) {
1056: [0]=>
1057: string(39) "This is line of text without csv fields"
1058: }
1059: int(60)
1060: bool(false)
1061:
1062: -- Testing fgetcsv() with file opened using rt mode --
1063: array(3) {
1064: [0]=>
1065: string(5) "water"
1066: [1]=>
1067: string(5) "fruit"
1068: [2]=>
1069: string(3) "air"
1070: }
1071: int(20)
1072: bool(false)
1073: array(1) {
1074: [0]=>
1075: string(39) "This is line of text without csv fields"
1076: }
1077: int(60)
1078: bool(false)
1079:
1080: -- Testing fgetcsv() with file opened using r+ mode --
1081: array(3) {
1082: [0]=>
1083: string(5) "water"
1084: [1]=>
1085: string(5) "fruit"
1086: [2]=>
1087: string(3) "air"
1088: }
1089: int(20)
1090: bool(false)
1091: array(1) {
1092: [0]=>
1093: string(39) "This is line of text without csv fields"
1094: }
1095: int(60)
1096: bool(false)
1097:
1098: -- Testing fgetcsv() with file opened using r+b mode --
1099: array(3) {
1100: [0]=>
1101: string(5) "water"
1102: [1]=>
1103: string(5) "fruit"
1104: [2]=>
1105: string(3) "air"
1106: }
1107: int(20)
1108: bool(false)
1109: array(1) {
1110: [0]=>
1111: string(39) "This is line of text without csv fields"
1112: }
1113: int(60)
1114: bool(false)
1115:
1116: -- Testing fgetcsv() with file opened using r+t mode --
1117: array(3) {
1118: [0]=>
1119: string(5) "water"
1120: [1]=>
1121: string(5) "fruit"
1122: [2]=>
1123: string(3) "air"
1124: }
1125: int(20)
1126: bool(false)
1127: array(1) {
1128: [0]=>
1129: string(39) "This is line of text without csv fields"
1130: }
1131: int(60)
1132: bool(false)
1133:
1134: -- Testing fgetcsv() with file opened using a+ mode --
1135: array(3) {
1136: [0]=>
1137: string(5) "water"
1138: [1]=>
1139: string(5) "fruit"
1140: [2]=>
1141: string(3) "air"
1142: }
1143: int(20)
1144: bool(false)
1145: array(1) {
1146: [0]=>
1147: string(39) "This is line of text without csv fields"
1148: }
1149: int(60)
1150: bool(false)
1151:
1152: -- Testing fgetcsv() with file opened using a+b mode --
1153: array(3) {
1154: [0]=>
1155: string(5) "water"
1156: [1]=>
1157: string(5) "fruit"
1158: [2]=>
1159: string(3) "air"
1160: }
1161: int(20)
1162: bool(false)
1163: array(1) {
1164: [0]=>
1165: string(39) "This is line of text without csv fields"
1166: }
1167: int(60)
1168: bool(false)
1169:
1170: -- Testing fgetcsv() with file opened using a+t mode --
1171: array(3) {
1172: [0]=>
1173: string(5) "water"
1174: [1]=>
1175: string(5) "fruit"
1176: [2]=>
1177: string(3) "air"
1178: }
1179: int(20)
1180: bool(false)
1181: array(1) {
1182: [0]=>
1183: string(39) "This is line of text without csv fields"
1184: }
1185: int(60)
1186: bool(false)
1187:
1188: -- Testing fgetcsv() with file opened using w+ mode --
1189: array(3) {
1190: [0]=>
1191: string(5) "water"
1192: [1]=>
1193: string(5) "fruit"
1194: [2]=>
1195: string(3) "air"
1196: }
1197: int(20)
1198: bool(false)
1199: array(1) {
1200: [0]=>
1201: string(39) "This is line of text without csv fields"
1202: }
1203: int(60)
1204: bool(false)
1205:
1206: -- Testing fgetcsv() with file opened using w+b mode --
1207: array(3) {
1208: [0]=>
1209: string(5) "water"
1210: [1]=>
1211: string(5) "fruit"
1212: [2]=>
1213: string(3) "air"
1214: }
1215: int(20)
1216: bool(false)
1217: array(1) {
1218: [0]=>
1219: string(39) "This is line of text without csv fields"
1220: }
1221: int(60)
1222: bool(false)
1223:
1224: -- Testing fgetcsv() with file opened using w+t mode --
1225: array(3) {
1226: [0]=>
1227: string(5) "water"
1228: [1]=>
1229: string(5) "fruit"
1230: [2]=>
1231: string(3) "air"
1232: }
1233: int(20)
1234: bool(false)
1235: array(1) {
1236: [0]=>
1237: string(39) "This is line of text without csv fields"
1238: }
1239: int(60)
1240: bool(false)
1241:
1242: -- Testing fgetcsv() with file opened using x+ mode --
1243: array(3) {
1244: [0]=>
1245: string(5) "water"
1246: [1]=>
1247: string(5) "fruit"
1248: [2]=>
1249: string(3) "air"
1250: }
1251: int(20)
1252: bool(false)
1253: array(1) {
1254: [0]=>
1255: string(39) "This is line of text without csv fields"
1256: }
1257: int(60)
1258: bool(false)
1259:
1260: -- Testing fgetcsv() with file opened using x+b mode --
1261: array(3) {
1262: [0]=>
1263: string(5) "water"
1264: [1]=>
1265: string(5) "fruit"
1266: [2]=>
1267: string(3) "air"
1268: }
1269: int(20)
1270: bool(false)
1271: array(1) {
1272: [0]=>
1273: string(39) "This is line of text without csv fields"
1274: }
1275: int(60)
1276: bool(false)
1277:
1278: -- Testing fgetcsv() with file opened using x+t mode --
1279: array(3) {
1280: [0]=>
1281: string(5) "water"
1282: [1]=>
1283: string(5) "fruit"
1284: [2]=>
1285: string(3) "air"
1286: }
1287: int(20)
1288: bool(false)
1289: array(1) {
1290: [0]=>
1291: string(39) "This is line of text without csv fields"
1292: }
1293: int(60)
1294: bool(false)
1295:
1296: -- Testing fgetcsv() with file opened using r mode --
1297: array(3) {
1298: [0]=>
1299: string(5) "water"
1300: [1]=>
1301: string(5) "fruit"
1302: [2]=>
1303: string(43) ""
1304: This is line of text without csv fields
1305:
1306: "
1307: }
1308: int(61)
1309: bool(true)
1310: bool(false)
1311: int(61)
1312: bool(true)
1313:
1314: -- Testing fgetcsv() with file opened using rb mode --
1315: array(3) {
1316: [0]=>
1317: string(5) "water"
1318: [1]=>
1319: string(5) "fruit"
1320: [2]=>
1321: string(43) ""
1322: This is line of text without csv fields
1323:
1324: "
1325: }
1326: int(61)
1327: bool(true)
1328: bool(false)
1329: int(61)
1330: bool(true)
1331:
1332: -- Testing fgetcsv() with file opened using rt mode --
1333: array(3) {
1334: [0]=>
1335: string(5) "water"
1336: [1]=>
1337: string(5) "fruit"
1338: [2]=>
1339: string(43) ""
1340: This is line of text without csv fields
1341:
1342: "
1343: }
1344: int(61)
1345: bool(true)
1346: bool(false)
1347: int(61)
1348: bool(true)
1349:
1350: -- Testing fgetcsv() with file opened using r+ mode --
1351: array(3) {
1352: [0]=>
1353: string(5) "water"
1354: [1]=>
1355: string(5) "fruit"
1356: [2]=>
1357: string(43) ""
1358: This is line of text without csv fields
1359:
1360: "
1361: }
1362: int(61)
1363: bool(true)
1364: bool(false)
1365: int(61)
1366: bool(true)
1367:
1368: -- Testing fgetcsv() with file opened using r+b mode --
1369: array(3) {
1370: [0]=>
1371: string(5) "water"
1372: [1]=>
1373: string(5) "fruit"
1374: [2]=>
1375: string(43) ""
1376: This is line of text without csv fields
1377:
1378: "
1379: }
1380: int(61)
1381: bool(true)
1382: bool(false)
1383: int(61)
1384: bool(true)
1385:
1386: -- Testing fgetcsv() with file opened using r+t mode --
1387: array(3) {
1388: [0]=>
1389: string(5) "water"
1390: [1]=>
1391: string(5) "fruit"
1392: [2]=>
1393: string(43) ""
1394: This is line of text without csv fields
1395:
1396: "
1397: }
1398: int(61)
1399: bool(true)
1400: bool(false)
1401: int(61)
1402: bool(true)
1403:
1404: -- Testing fgetcsv() with file opened using a+ mode --
1405: array(3) {
1406: [0]=>
1407: string(5) "water"
1408: [1]=>
1409: string(5) "fruit"
1410: [2]=>
1411: string(43) ""
1412: This is line of text without csv fields
1413:
1414: "
1415: }
1416: int(61)
1417: bool(true)
1418: bool(false)
1419: int(61)
1420: bool(true)
1421:
1422: -- Testing fgetcsv() with file opened using a+b mode --
1423: array(3) {
1424: [0]=>
1425: string(5) "water"
1426: [1]=>
1427: string(5) "fruit"
1428: [2]=>
1429: string(43) ""
1430: This is line of text without csv fields
1431:
1432: "
1433: }
1434: int(61)
1435: bool(true)
1436: bool(false)
1437: int(61)
1438: bool(true)
1439:
1440: -- Testing fgetcsv() with file opened using a+t mode --
1441: array(3) {
1442: [0]=>
1443: string(5) "water"
1444: [1]=>
1445: string(5) "fruit"
1446: [2]=>
1447: string(43) ""
1448: This is line of text without csv fields
1449:
1450: "
1451: }
1452: int(61)
1453: bool(true)
1454: bool(false)
1455: int(61)
1456: bool(true)
1457:
1458: -- Testing fgetcsv() with file opened using w+ mode --
1459: array(3) {
1460: [0]=>
1461: string(5) "water"
1462: [1]=>
1463: string(5) "fruit"
1464: [2]=>
1465: string(43) ""
1466: This is line of text without csv fields
1467:
1468: "
1469: }
1470: int(61)
1471: bool(true)
1472: bool(false)
1473: int(61)
1474: bool(true)
1475:
1476: -- Testing fgetcsv() with file opened using w+b mode --
1477: array(3) {
1478: [0]=>
1479: string(5) "water"
1480: [1]=>
1481: string(5) "fruit"
1482: [2]=>
1483: string(43) ""
1484: This is line of text without csv fields
1485:
1486: "
1487: }
1488: int(61)
1489: bool(true)
1490: bool(false)
1491: int(61)
1492: bool(true)
1493:
1494: -- Testing fgetcsv() with file opened using w+t mode --
1495: array(3) {
1496: [0]=>
1497: string(5) "water"
1498: [1]=>
1499: string(5) "fruit"
1500: [2]=>
1501: string(43) ""
1502: This is line of text without csv fields
1503:
1504: "
1505: }
1506: int(61)
1507: bool(true)
1508: bool(false)
1509: int(61)
1510: bool(true)
1511:
1512: -- Testing fgetcsv() with file opened using x+ mode --
1513: array(3) {
1514: [0]=>
1515: string(5) "water"
1516: [1]=>
1517: string(5) "fruit"
1518: [2]=>
1519: string(43) ""
1520: This is line of text without csv fields
1521:
1522: "
1523: }
1524: int(61)
1525: bool(true)
1526: bool(false)
1527: int(61)
1528: bool(true)
1529:
1530: -- Testing fgetcsv() with file opened using x+b mode --
1531: array(3) {
1532: [0]=>
1533: string(5) "water"
1534: [1]=>
1535: string(5) "fruit"
1536: [2]=>
1537: string(43) ""
1538: This is line of text without csv fields
1539:
1540: "
1541: }
1542: int(61)
1543: bool(true)
1544: bool(false)
1545: int(61)
1546: bool(true)
1547:
1548: -- Testing fgetcsv() with file opened using x+t mode --
1549: array(3) {
1550: [0]=>
1551: string(5) "water"
1552: [1]=>
1553: string(5) "fruit"
1554: [2]=>
1555: string(43) ""
1556: This is line of text without csv fields
1557:
1558: "
1559: }
1560: int(61)
1561: bool(true)
1562: bool(false)
1563: int(61)
1564: bool(true)
1565: Done