1--TEST-- 2Test 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 13echo "*** 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; 39foreach ($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 beginning of the file 63 if ( strstr($file_modes[$mode_counter], "r" ) ) { 64 fclose($file_handle); 65 $file_handle = fopen($filename, $file_modes[$mode_counter]); 66 } else { 67 // rewind the file pointer to bof 68 rewind($file_handle); 69 } 70 71 echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n"; 72 73 // call fgetcsv() to parse csv fields 74 75 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 91echo "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 -- 97array(2) { 98 [0]=> 99 string(7) ""water"" 100 [1]=> 101 string(5) "fruit" 102} 103int(14) 104bool(false) 105 106-- Testing fgetcsv() with file opened using rb mode -- 107array(2) { 108 [0]=> 109 string(7) ""water"" 110 [1]=> 111 string(5) "fruit" 112} 113int(14) 114bool(false) 115 116-- Testing fgetcsv() with file opened using rt mode -- 117array(2) { 118 [0]=> 119 string(7) ""water"" 120 [1]=> 121 string(5) "fruit" 122} 123int(14) 124bool(false) 125 126-- Testing fgetcsv() with file opened using r+ mode -- 127array(2) { 128 [0]=> 129 string(7) ""water"" 130 [1]=> 131 string(5) "fruit" 132} 133int(14) 134bool(false) 135 136-- Testing fgetcsv() with file opened using r+b mode -- 137array(2) { 138 [0]=> 139 string(7) ""water"" 140 [1]=> 141 string(5) "fruit" 142} 143int(14) 144bool(false) 145 146-- Testing fgetcsv() with file opened using r+t mode -- 147array(2) { 148 [0]=> 149 string(7) ""water"" 150 [1]=> 151 string(5) "fruit" 152} 153int(14) 154bool(false) 155 156-- Testing fgetcsv() with file opened using a+ mode -- 157array(2) { 158 [0]=> 159 string(7) ""water"" 160 [1]=> 161 string(5) "fruit" 162} 163int(14) 164bool(false) 165 166-- Testing fgetcsv() with file opened using a+b mode -- 167array(2) { 168 [0]=> 169 string(7) ""water"" 170 [1]=> 171 string(5) "fruit" 172} 173int(14) 174bool(false) 175 176-- Testing fgetcsv() with file opened using a+t mode -- 177array(2) { 178 [0]=> 179 string(7) ""water"" 180 [1]=> 181 string(5) "fruit" 182} 183int(14) 184bool(false) 185 186-- Testing fgetcsv() with file opened using w+ mode -- 187array(2) { 188 [0]=> 189 string(7) ""water"" 190 [1]=> 191 string(5) "fruit" 192} 193int(14) 194bool(false) 195 196-- Testing fgetcsv() with file opened using w+b mode -- 197array(2) { 198 [0]=> 199 string(7) ""water"" 200 [1]=> 201 string(5) "fruit" 202} 203int(14) 204bool(false) 205 206-- Testing fgetcsv() with file opened using w+t mode -- 207array(2) { 208 [0]=> 209 string(7) ""water"" 210 [1]=> 211 string(5) "fruit" 212} 213int(14) 214bool(false) 215 216-- Testing fgetcsv() with file opened using x+ mode -- 217array(2) { 218 [0]=> 219 string(7) ""water"" 220 [1]=> 221 string(5) "fruit" 222} 223int(14) 224bool(false) 225 226-- Testing fgetcsv() with file opened using x+b mode -- 227array(2) { 228 [0]=> 229 string(7) ""water"" 230 [1]=> 231 string(5) "fruit" 232} 233int(14) 234bool(false) 235 236-- Testing fgetcsv() with file opened using x+t mode -- 237array(2) { 238 [0]=> 239 string(7) ""water"" 240 [1]=> 241 string(5) "fruit" 242} 243int(14) 244bool(false) 245 246-- Testing fgetcsv() with file opened using r mode -- 247array(2) { 248 [0]=> 249 string(7) ""water"" 250 [1]=> 251 string(7) ""fruit"" 252} 253int(16) 254bool(false) 255 256-- Testing fgetcsv() with file opened using rb mode -- 257array(2) { 258 [0]=> 259 string(7) ""water"" 260 [1]=> 261 string(7) ""fruit"" 262} 263int(16) 264bool(false) 265 266-- Testing fgetcsv() with file opened using rt mode -- 267array(2) { 268 [0]=> 269 string(7) ""water"" 270 [1]=> 271 string(7) ""fruit"" 272} 273int(16) 274bool(false) 275 276-- Testing fgetcsv() with file opened using r+ mode -- 277array(2) { 278 [0]=> 279 string(7) ""water"" 280 [1]=> 281 string(7) ""fruit"" 282} 283int(16) 284bool(false) 285 286-- Testing fgetcsv() with file opened using r+b mode -- 287array(2) { 288 [0]=> 289 string(7) ""water"" 290 [1]=> 291 string(7) ""fruit"" 292} 293int(16) 294bool(false) 295 296-- Testing fgetcsv() with file opened using r+t mode -- 297array(2) { 298 [0]=> 299 string(7) ""water"" 300 [1]=> 301 string(7) ""fruit"" 302} 303int(16) 304bool(false) 305 306-- Testing fgetcsv() with file opened using a+ mode -- 307array(2) { 308 [0]=> 309 string(7) ""water"" 310 [1]=> 311 string(7) ""fruit"" 312} 313int(16) 314bool(false) 315 316-- Testing fgetcsv() with file opened using a+b mode -- 317array(2) { 318 [0]=> 319 string(7) ""water"" 320 [1]=> 321 string(7) ""fruit"" 322} 323int(16) 324bool(false) 325 326-- Testing fgetcsv() with file opened using a+t mode -- 327array(2) { 328 [0]=> 329 string(7) ""water"" 330 [1]=> 331 string(7) ""fruit"" 332} 333int(16) 334bool(false) 335 336-- Testing fgetcsv() with file opened using w+ mode -- 337array(2) { 338 [0]=> 339 string(7) ""water"" 340 [1]=> 341 string(7) ""fruit"" 342} 343int(16) 344bool(false) 345 346-- Testing fgetcsv() with file opened using w+b mode -- 347array(2) { 348 [0]=> 349 string(7) ""water"" 350 [1]=> 351 string(7) ""fruit"" 352} 353int(16) 354bool(false) 355 356-- Testing fgetcsv() with file opened using w+t mode -- 357array(2) { 358 [0]=> 359 string(7) ""water"" 360 [1]=> 361 string(7) ""fruit"" 362} 363int(16) 364bool(false) 365 366-- Testing fgetcsv() with file opened using x+ mode -- 367array(2) { 368 [0]=> 369 string(7) ""water"" 370 [1]=> 371 string(7) ""fruit"" 372} 373int(16) 374bool(false) 375 376-- Testing fgetcsv() with file opened using x+b mode -- 377array(2) { 378 [0]=> 379 string(7) ""water"" 380 [1]=> 381 string(7) ""fruit"" 382} 383int(16) 384bool(false) 385 386-- Testing fgetcsv() with file opened using x+t mode -- 387array(2) { 388 [0]=> 389 string(7) ""water"" 390 [1]=> 391 string(7) ""fruit"" 392} 393int(16) 394bool(false) 395 396-- Testing fgetcsv() with file opened using r mode -- 397array(2) { 398 [0]=> 399 string(7) "^water^" 400 [1]=> 401 string(7) "^fruit^" 402} 403int(16) 404bool(false) 405 406-- Testing fgetcsv() with file opened using rb mode -- 407array(2) { 408 [0]=> 409 string(7) "^water^" 410 [1]=> 411 string(7) "^fruit^" 412} 413int(16) 414bool(false) 415 416-- Testing fgetcsv() with file opened using rt mode -- 417array(2) { 418 [0]=> 419 string(7) "^water^" 420 [1]=> 421 string(7) "^fruit^" 422} 423int(16) 424bool(false) 425 426-- Testing fgetcsv() with file opened using r+ mode -- 427array(2) { 428 [0]=> 429 string(7) "^water^" 430 [1]=> 431 string(7) "^fruit^" 432} 433int(16) 434bool(false) 435 436-- Testing fgetcsv() with file opened using r+b mode -- 437array(2) { 438 [0]=> 439 string(7) "^water^" 440 [1]=> 441 string(7) "^fruit^" 442} 443int(16) 444bool(false) 445 446-- Testing fgetcsv() with file opened using r+t mode -- 447array(2) { 448 [0]=> 449 string(7) "^water^" 450 [1]=> 451 string(7) "^fruit^" 452} 453int(16) 454bool(false) 455 456-- Testing fgetcsv() with file opened using a+ mode -- 457array(2) { 458 [0]=> 459 string(7) "^water^" 460 [1]=> 461 string(7) "^fruit^" 462} 463int(16) 464bool(false) 465 466-- Testing fgetcsv() with file opened using a+b mode -- 467array(2) { 468 [0]=> 469 string(7) "^water^" 470 [1]=> 471 string(7) "^fruit^" 472} 473int(16) 474bool(false) 475 476-- Testing fgetcsv() with file opened using a+t mode -- 477array(2) { 478 [0]=> 479 string(7) "^water^" 480 [1]=> 481 string(7) "^fruit^" 482} 483int(16) 484bool(false) 485 486-- Testing fgetcsv() with file opened using w+ mode -- 487array(2) { 488 [0]=> 489 string(7) "^water^" 490 [1]=> 491 string(7) "^fruit^" 492} 493int(16) 494bool(false) 495 496-- Testing fgetcsv() with file opened using w+b mode -- 497array(2) { 498 [0]=> 499 string(7) "^water^" 500 [1]=> 501 string(7) "^fruit^" 502} 503int(16) 504bool(false) 505 506-- Testing fgetcsv() with file opened using w+t mode -- 507array(2) { 508 [0]=> 509 string(7) "^water^" 510 [1]=> 511 string(7) "^fruit^" 512} 513int(16) 514bool(false) 515 516-- Testing fgetcsv() with file opened using x+ mode -- 517array(2) { 518 [0]=> 519 string(7) "^water^" 520 [1]=> 521 string(7) "^fruit^" 522} 523int(16) 524bool(false) 525 526-- Testing fgetcsv() with file opened using x+b mode -- 527array(2) { 528 [0]=> 529 string(7) "^water^" 530 [1]=> 531 string(7) "^fruit^" 532} 533int(16) 534bool(false) 535 536-- Testing fgetcsv() with file opened using x+t mode -- 537array(2) { 538 [0]=> 539 string(7) "^water^" 540 [1]=> 541 string(7) "^fruit^" 542} 543int(16) 544bool(false) 545 546-- Testing fgetcsv() with file opened using r mode -- 547array(2) { 548 [0]=> 549 string(7) "&water&" 550 [1]=> 551 string(7) "&fruit&" 552} 553int(16) 554bool(false) 555 556-- Testing fgetcsv() with file opened using rb mode -- 557array(2) { 558 [0]=> 559 string(7) "&water&" 560 [1]=> 561 string(7) "&fruit&" 562} 563int(16) 564bool(false) 565 566-- Testing fgetcsv() with file opened using rt mode -- 567array(2) { 568 [0]=> 569 string(7) "&water&" 570 [1]=> 571 string(7) "&fruit&" 572} 573int(16) 574bool(false) 575 576-- Testing fgetcsv() with file opened using r+ mode -- 577array(2) { 578 [0]=> 579 string(7) "&water&" 580 [1]=> 581 string(7) "&fruit&" 582} 583int(16) 584bool(false) 585 586-- Testing fgetcsv() with file opened using r+b mode -- 587array(2) { 588 [0]=> 589 string(7) "&water&" 590 [1]=> 591 string(7) "&fruit&" 592} 593int(16) 594bool(false) 595 596-- Testing fgetcsv() with file opened using r+t mode -- 597array(2) { 598 [0]=> 599 string(7) "&water&" 600 [1]=> 601 string(7) "&fruit&" 602} 603int(16) 604bool(false) 605 606-- Testing fgetcsv() with file opened using a+ mode -- 607array(2) { 608 [0]=> 609 string(7) "&water&" 610 [1]=> 611 string(7) "&fruit&" 612} 613int(16) 614bool(false) 615 616-- Testing fgetcsv() with file opened using a+b mode -- 617array(2) { 618 [0]=> 619 string(7) "&water&" 620 [1]=> 621 string(7) "&fruit&" 622} 623int(16) 624bool(false) 625 626-- Testing fgetcsv() with file opened using a+t mode -- 627array(2) { 628 [0]=> 629 string(7) "&water&" 630 [1]=> 631 string(7) "&fruit&" 632} 633int(16) 634bool(false) 635 636-- Testing fgetcsv() with file opened using w+ mode -- 637array(2) { 638 [0]=> 639 string(7) "&water&" 640 [1]=> 641 string(7) "&fruit&" 642} 643int(16) 644bool(false) 645 646-- Testing fgetcsv() with file opened using w+b mode -- 647array(2) { 648 [0]=> 649 string(7) "&water&" 650 [1]=> 651 string(7) "&fruit&" 652} 653int(16) 654bool(false) 655 656-- Testing fgetcsv() with file opened using w+t mode -- 657array(2) { 658 [0]=> 659 string(7) "&water&" 660 [1]=> 661 string(7) "&fruit&" 662} 663int(16) 664bool(false) 665 666-- Testing fgetcsv() with file opened using x+ mode -- 667array(2) { 668 [0]=> 669 string(7) "&water&" 670 [1]=> 671 string(7) "&fruit&" 672} 673int(16) 674bool(false) 675 676-- Testing fgetcsv() with file opened using x+b mode -- 677array(2) { 678 [0]=> 679 string(7) "&water&" 680 [1]=> 681 string(7) "&fruit&" 682} 683int(16) 684bool(false) 685 686-- Testing fgetcsv() with file opened using x+t mode -- 687array(2) { 688 [0]=> 689 string(7) "&water&" 690 [1]=> 691 string(7) "&fruit&" 692} 693int(16) 694bool(false) 695 696-- Testing fgetcsv() with file opened using r mode -- 697array(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} 711int(16) 712bool(false) 713 714-- Testing fgetcsv() with file opened using rb mode -- 715array(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} 729int(16) 730bool(false) 731 732-- Testing fgetcsv() with file opened using rt mode -- 733array(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} 747int(16) 748bool(false) 749 750-- Testing fgetcsv() with file opened using r+ mode -- 751array(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} 765int(16) 766bool(false) 767 768-- Testing fgetcsv() with file opened using r+b mode -- 769array(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} 783int(16) 784bool(false) 785 786-- Testing fgetcsv() with file opened using r+t mode -- 787array(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} 801int(16) 802bool(false) 803 804-- Testing fgetcsv() with file opened using a+ mode -- 805array(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} 819int(16) 820bool(false) 821 822-- Testing fgetcsv() with file opened using a+b mode -- 823array(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} 837int(16) 838bool(false) 839 840-- Testing fgetcsv() with file opened using a+t mode -- 841array(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} 855int(16) 856bool(false) 857 858-- Testing fgetcsv() with file opened using w+ mode -- 859array(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} 873int(16) 874bool(false) 875 876-- Testing fgetcsv() with file opened using w+b mode -- 877array(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} 891int(16) 892bool(false) 893 894-- Testing fgetcsv() with file opened using w+t mode -- 895array(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} 909int(16) 910bool(false) 911 912-- Testing fgetcsv() with file opened using x+ mode -- 913array(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} 927int(16) 928bool(false) 929 930-- Testing fgetcsv() with file opened using x+b mode -- 931array(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} 945int(16) 946bool(false) 947 948-- Testing fgetcsv() with file opened using x+t mode -- 949array(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} 963int(16) 964bool(false) 965 966-- Testing fgetcsv() with file opened using r mode -- 967array(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} 979int(18) 980bool(false) 981 982-- Testing fgetcsv() with file opened using rb mode -- 983array(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} 995int(18) 996bool(false) 997 998-- Testing fgetcsv() with file opened using rt mode -- 999array(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} 1011int(18) 1012bool(false) 1013 1014-- Testing fgetcsv() with file opened using r+ mode -- 1015array(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} 1027int(18) 1028bool(false) 1029 1030-- Testing fgetcsv() with file opened using r+b mode -- 1031array(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} 1043int(18) 1044bool(false) 1045 1046-- Testing fgetcsv() with file opened using r+t mode -- 1047array(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} 1059int(18) 1060bool(false) 1061 1062-- Testing fgetcsv() with file opened using a+ mode -- 1063array(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} 1075int(18) 1076bool(false) 1077 1078-- Testing fgetcsv() with file opened using a+b mode -- 1079array(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} 1091int(18) 1092bool(false) 1093 1094-- Testing fgetcsv() with file opened using a+t mode -- 1095array(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} 1107int(18) 1108bool(false) 1109 1110-- Testing fgetcsv() with file opened using w+ mode -- 1111array(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} 1123int(18) 1124bool(false) 1125 1126-- Testing fgetcsv() with file opened using w+b mode -- 1127array(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} 1139int(18) 1140bool(false) 1141 1142-- Testing fgetcsv() with file opened using w+t mode -- 1143array(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} 1155int(18) 1156bool(false) 1157 1158-- Testing fgetcsv() with file opened using x+ mode -- 1159array(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} 1171int(18) 1172bool(false) 1173 1174-- Testing fgetcsv() with file opened using x+b mode -- 1175array(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} 1187int(18) 1188bool(false) 1189 1190-- Testing fgetcsv() with file opened using x+t mode -- 1191array(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} 1203int(18) 1204bool(false) 1205 1206-- Testing fgetcsv() with file opened using r mode -- 1207array(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} 1227int(22) 1228bool(false) 1229 1230-- Testing fgetcsv() with file opened using rb mode -- 1231array(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} 1251int(22) 1252bool(false) 1253 1254-- Testing fgetcsv() with file opened using rt mode -- 1255array(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} 1275int(22) 1276bool(false) 1277 1278-- Testing fgetcsv() with file opened using r+ mode -- 1279array(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} 1299int(22) 1300bool(false) 1301 1302-- Testing fgetcsv() with file opened using r+b mode -- 1303array(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} 1323int(22) 1324bool(false) 1325 1326-- Testing fgetcsv() with file opened using r+t mode -- 1327array(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} 1347int(22) 1348bool(false) 1349 1350-- Testing fgetcsv() with file opened using a+ mode -- 1351array(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} 1371int(22) 1372bool(false) 1373 1374-- Testing fgetcsv() with file opened using a+b mode -- 1375array(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} 1395int(22) 1396bool(false) 1397 1398-- Testing fgetcsv() with file opened using a+t mode -- 1399array(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} 1419int(22) 1420bool(false) 1421 1422-- Testing fgetcsv() with file opened using w+ mode -- 1423array(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} 1443int(22) 1444bool(false) 1445 1446-- Testing fgetcsv() with file opened using w+b mode -- 1447array(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} 1467int(22) 1468bool(false) 1469 1470-- Testing fgetcsv() with file opened using w+t mode -- 1471array(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} 1491int(22) 1492bool(false) 1493 1494-- Testing fgetcsv() with file opened using x+ mode -- 1495array(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} 1515int(22) 1516bool(false) 1517 1518-- Testing fgetcsv() with file opened using x+b mode -- 1519array(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} 1539int(22) 1540bool(false) 1541 1542-- Testing fgetcsv() with file opened using x+t mode -- 1543array(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} 1563int(22) 1564bool(false) 1565 1566-- Testing fgetcsv() with file opened using r mode -- 1567array(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} 1581int(24) 1582bool(false) 1583 1584-- Testing fgetcsv() with file opened using rb mode -- 1585array(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} 1599int(24) 1600bool(false) 1601 1602-- Testing fgetcsv() with file opened using rt mode -- 1603array(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} 1617int(24) 1618bool(false) 1619 1620-- Testing fgetcsv() with file opened using r+ mode -- 1621array(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} 1635int(24) 1636bool(false) 1637 1638-- Testing fgetcsv() with file opened using r+b mode -- 1639array(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} 1653int(24) 1654bool(false) 1655 1656-- Testing fgetcsv() with file opened using r+t mode -- 1657array(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} 1671int(24) 1672bool(false) 1673 1674-- Testing fgetcsv() with file opened using a+ mode -- 1675array(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} 1689int(24) 1690bool(false) 1691 1692-- Testing fgetcsv() with file opened using a+b mode -- 1693array(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} 1707int(24) 1708bool(false) 1709 1710-- Testing fgetcsv() with file opened using a+t mode -- 1711array(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} 1725int(24) 1726bool(false) 1727 1728-- Testing fgetcsv() with file opened using w+ mode -- 1729array(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} 1743int(24) 1744bool(false) 1745 1746-- Testing fgetcsv() with file opened using w+b mode -- 1747array(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} 1761int(24) 1762bool(false) 1763 1764-- Testing fgetcsv() with file opened using w+t mode -- 1765array(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} 1779int(24) 1780bool(false) 1781 1782-- Testing fgetcsv() with file opened using x+ mode -- 1783array(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} 1797int(24) 1798bool(false) 1799 1800-- Testing fgetcsv() with file opened using x+b mode -- 1801array(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} 1815int(24) 1816bool(false) 1817 1818-- Testing fgetcsv() with file opened using x+t mode -- 1819array(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} 1833int(24) 1834bool(false) 1835Done 1836