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