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