1--TEST-- 2Test fgetcsv() : usage variations - two chars as enclosure & delimiter (various read and append modes) 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 providing two characters for enclosure and delimiter parameters */ 11 12echo "*** Testing fgetcsv() : with two chars as enclosure & delimiter ***\n"; 13 14/* the array is with three elements in it. Each element should be read as 15 1st element is delimiter, 2nd element is enclosure 16 and 3rd element is csv fields 17*/ 18$csv_lists = array ( 19 array(',', '"', '"water",fruit'), 20 array(',', '"', '"water","fruit"'), 21 array(' ', '^', '^water^ ^fruit^'), 22 array(':', '&', '&water&:&fruit&'), 23 array('=', '=', '=water===fruit='), 24 array('-', '-', '-water--fruit-air'), 25 array('-', '-', '-water---fruit---air-'), 26 array(':', '&', '&""""&:&"&:,:":&,&:,,,,') 27); 28 29$filename = dirname(__FILE__) . '/fgetcsv_variation12.tmp'; 30@unlink($filename); 31 32$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t", 33 "a+", "a+b", "a+t"); 34 35$loop_counter = 1; 36foreach ($csv_lists as $csv_list) { 37 for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { 38 // create the file and add the content with has csv fields 39 if ( strstr($file_modes[$mode_counter], "r") ) { 40 $file_handle = fopen($filename, "w"); 41 } else { 42 $file_handle = fopen($filename, $file_modes[$mode_counter] ); 43 } 44 if ( !$file_handle ) { 45 echo "Error: failed to create file $filename!\n"; 46 exit(); 47 } 48 $delimiter = $csv_list[0]; 49 $enclosure = $csv_list[1]; 50 $csv_field = $csv_list[2]; 51 fwrite($file_handle, $csv_field . "\n"); 52 53 // write another line of text and a blank line 54 // this will be used to test, if the fgetcsv() read more than a line and its 55 // working when only a blank line is read 56 fwrite($file_handle, "This is line of text without csv fields\n"); 57 fwrite($file_handle, "\n"); // blank line 58 59 // close the file if the mode to be used is read mode and re-open using read mode 60 // else rewind the file pointer to beginning of the file 61 if ( strstr($file_modes[$mode_counter], "r" ) ) { 62 fclose($file_handle); 63 $file_handle = fopen($filename, $file_modes[$mode_counter]); 64 } else { 65 // rewind the file pointer to bof 66 rewind($file_handle); 67 } 68 69 echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n"; 70 71 // call fgetcsv() to parse csv fields 72 73 // use delimiter & enclosure char of two chars 74 fseek($file_handle, 0, SEEK_SET); 75 $del = "++"; 76 $enc = "%%"; 77 var_dump( fgetcsv($file_handle, 1024, $del, $enc) ); 78 // check the file pointer position and if eof 79 var_dump( ftell($file_handle) ); 80 var_dump( feof($file_handle) ); 81 82 // close the file 83 fclose($file_handle); 84 //delete file 85 unlink($filename); 86 } //end of mode loop 87} // end of foreach 88 89echo "Done\n"; 90?> 91--EXPECTF-- 92*** Testing fgetcsv() : with two chars as enclosure & delimiter *** 93 94-- Testing fgetcsv() with file opened using r mode -- 95 96Notice: fgetcsv(): delimiter must be a single character in %s on line %d 97 98Notice: fgetcsv(): enclosure must be a single character in %s on line %d 99array(1) { 100 [0]=> 101 string(13) ""water",fruit" 102} 103int(14) 104bool(false) 105 106-- Testing fgetcsv() with file opened using rb mode -- 107 108Notice: fgetcsv(): delimiter must be a single character in %s on line %d 109 110Notice: fgetcsv(): enclosure must be a single character in %s on line %d 111array(1) { 112 [0]=> 113 string(13) ""water",fruit" 114} 115int(14) 116bool(false) 117 118-- Testing fgetcsv() with file opened using rt mode -- 119 120Notice: fgetcsv(): delimiter must be a single character in %s on line %d 121 122Notice: fgetcsv(): enclosure must be a single character in %s on line %d 123array(1) { 124 [0]=> 125 string(13) ""water",fruit" 126} 127int(14) 128bool(false) 129 130-- Testing fgetcsv() with file opened using r+ mode -- 131 132Notice: fgetcsv(): delimiter must be a single character in %s on line %d 133 134Notice: fgetcsv(): enclosure must be a single character in %s on line %d 135array(1) { 136 [0]=> 137 string(13) ""water",fruit" 138} 139int(14) 140bool(false) 141 142-- Testing fgetcsv() with file opened using r+b mode -- 143 144Notice: fgetcsv(): delimiter must be a single character in %s on line %d 145 146Notice: fgetcsv(): enclosure must be a single character in %s on line %d 147array(1) { 148 [0]=> 149 string(13) ""water",fruit" 150} 151int(14) 152bool(false) 153 154-- Testing fgetcsv() with file opened using r+t mode -- 155 156Notice: fgetcsv(): delimiter must be a single character in %s on line %d 157 158Notice: fgetcsv(): enclosure must be a single character in %s on line %d 159array(1) { 160 [0]=> 161 string(13) ""water",fruit" 162} 163int(14) 164bool(false) 165 166-- Testing fgetcsv() with file opened using a+ mode -- 167 168Notice: fgetcsv(): delimiter must be a single character in %s on line %d 169 170Notice: fgetcsv(): enclosure must be a single character in %s on line %d 171array(1) { 172 [0]=> 173 string(13) ""water",fruit" 174} 175int(14) 176bool(false) 177 178-- Testing fgetcsv() with file opened using a+b mode -- 179 180Notice: fgetcsv(): delimiter must be a single character in %s on line %d 181 182Notice: fgetcsv(): enclosure must be a single character in %s on line %d 183array(1) { 184 [0]=> 185 string(13) ""water",fruit" 186} 187int(14) 188bool(false) 189 190-- Testing fgetcsv() with file opened using a+t mode -- 191 192Notice: fgetcsv(): delimiter must be a single character in %s on line %d 193 194Notice: fgetcsv(): enclosure must be a single character in %s on line %d 195array(1) { 196 [0]=> 197 string(13) ""water",fruit" 198} 199int(14) 200bool(false) 201 202-- Testing fgetcsv() with file opened using r mode -- 203 204Notice: fgetcsv(): delimiter must be a single character in %s on line %d 205 206Notice: fgetcsv(): enclosure must be a single character in %s on line %d 207array(1) { 208 [0]=> 209 string(15) ""water","fruit"" 210} 211int(16) 212bool(false) 213 214-- Testing fgetcsv() with file opened using rb mode -- 215 216Notice: fgetcsv(): delimiter must be a single character in %s on line %d 217 218Notice: fgetcsv(): enclosure must be a single character in %s on line %d 219array(1) { 220 [0]=> 221 string(15) ""water","fruit"" 222} 223int(16) 224bool(false) 225 226-- Testing fgetcsv() with file opened using rt mode -- 227 228Notice: fgetcsv(): delimiter must be a single character in %s on line %d 229 230Notice: fgetcsv(): enclosure must be a single character in %s on line %d 231array(1) { 232 [0]=> 233 string(15) ""water","fruit"" 234} 235int(16) 236bool(false) 237 238-- Testing fgetcsv() with file opened using r+ mode -- 239 240Notice: fgetcsv(): delimiter must be a single character in %s on line %d 241 242Notice: fgetcsv(): enclosure must be a single character in %s on line %d 243array(1) { 244 [0]=> 245 string(15) ""water","fruit"" 246} 247int(16) 248bool(false) 249 250-- Testing fgetcsv() with file opened using r+b mode -- 251 252Notice: fgetcsv(): delimiter must be a single character in %s on line %d 253 254Notice: fgetcsv(): enclosure must be a single character in %s on line %d 255array(1) { 256 [0]=> 257 string(15) ""water","fruit"" 258} 259int(16) 260bool(false) 261 262-- Testing fgetcsv() with file opened using r+t mode -- 263 264Notice: fgetcsv(): delimiter must be a single character in %s on line %d 265 266Notice: fgetcsv(): enclosure must be a single character in %s on line %d 267array(1) { 268 [0]=> 269 string(15) ""water","fruit"" 270} 271int(16) 272bool(false) 273 274-- Testing fgetcsv() with file opened using a+ mode -- 275 276Notice: fgetcsv(): delimiter must be a single character in %s on line %d 277 278Notice: fgetcsv(): enclosure must be a single character in %s on line %d 279array(1) { 280 [0]=> 281 string(15) ""water","fruit"" 282} 283int(16) 284bool(false) 285 286-- Testing fgetcsv() with file opened using a+b mode -- 287 288Notice: fgetcsv(): delimiter must be a single character in %s on line %d 289 290Notice: fgetcsv(): enclosure must be a single character in %s on line %d 291array(1) { 292 [0]=> 293 string(15) ""water","fruit"" 294} 295int(16) 296bool(false) 297 298-- Testing fgetcsv() with file opened using a+t mode -- 299 300Notice: fgetcsv(): delimiter must be a single character in %s on line %d 301 302Notice: fgetcsv(): enclosure must be a single character in %s on line %d 303array(1) { 304 [0]=> 305 string(15) ""water","fruit"" 306} 307int(16) 308bool(false) 309 310-- Testing fgetcsv() with file opened using r mode -- 311 312Notice: fgetcsv(): delimiter must be a single character in %s on line %d 313 314Notice: fgetcsv(): enclosure must be a single character in %s on line %d 315array(1) { 316 [0]=> 317 string(15) "^water^ ^fruit^" 318} 319int(16) 320bool(false) 321 322-- Testing fgetcsv() with file opened using rb mode -- 323 324Notice: fgetcsv(): delimiter must be a single character in %s on line %d 325 326Notice: fgetcsv(): enclosure must be a single character in %s on line %d 327array(1) { 328 [0]=> 329 string(15) "^water^ ^fruit^" 330} 331int(16) 332bool(false) 333 334-- Testing fgetcsv() with file opened using rt mode -- 335 336Notice: fgetcsv(): delimiter must be a single character in %s on line %d 337 338Notice: fgetcsv(): enclosure must be a single character in %s on line %d 339array(1) { 340 [0]=> 341 string(15) "^water^ ^fruit^" 342} 343int(16) 344bool(false) 345 346-- Testing fgetcsv() with file opened using r+ mode -- 347 348Notice: fgetcsv(): delimiter must be a single character in %s on line %d 349 350Notice: fgetcsv(): enclosure must be a single character in %s on line %d 351array(1) { 352 [0]=> 353 string(15) "^water^ ^fruit^" 354} 355int(16) 356bool(false) 357 358-- Testing fgetcsv() with file opened using r+b mode -- 359 360Notice: fgetcsv(): delimiter must be a single character in %s on line %d 361 362Notice: fgetcsv(): enclosure must be a single character in %s on line %d 363array(1) { 364 [0]=> 365 string(15) "^water^ ^fruit^" 366} 367int(16) 368bool(false) 369 370-- Testing fgetcsv() with file opened using r+t mode -- 371 372Notice: fgetcsv(): delimiter must be a single character in %s on line %d 373 374Notice: fgetcsv(): enclosure must be a single character in %s on line %d 375array(1) { 376 [0]=> 377 string(15) "^water^ ^fruit^" 378} 379int(16) 380bool(false) 381 382-- Testing fgetcsv() with file opened using a+ mode -- 383 384Notice: fgetcsv(): delimiter must be a single character in %s on line %d 385 386Notice: fgetcsv(): enclosure must be a single character in %s on line %d 387array(1) { 388 [0]=> 389 string(15) "^water^ ^fruit^" 390} 391int(16) 392bool(false) 393 394-- Testing fgetcsv() with file opened using a+b mode -- 395 396Notice: fgetcsv(): delimiter must be a single character in %s on line %d 397 398Notice: fgetcsv(): enclosure must be a single character in %s on line %d 399array(1) { 400 [0]=> 401 string(15) "^water^ ^fruit^" 402} 403int(16) 404bool(false) 405 406-- Testing fgetcsv() with file opened using a+t mode -- 407 408Notice: fgetcsv(): delimiter must be a single character in %s on line %d 409 410Notice: fgetcsv(): enclosure must be a single character in %s on line %d 411array(1) { 412 [0]=> 413 string(15) "^water^ ^fruit^" 414} 415int(16) 416bool(false) 417 418-- Testing fgetcsv() with file opened using r mode -- 419 420Notice: fgetcsv(): delimiter must be a single character in %s on line %d 421 422Notice: fgetcsv(): enclosure must be a single character in %s on line %d 423array(1) { 424 [0]=> 425 string(15) "&water&:&fruit&" 426} 427int(16) 428bool(false) 429 430-- Testing fgetcsv() with file opened using rb mode -- 431 432Notice: fgetcsv(): delimiter must be a single character in %s on line %d 433 434Notice: fgetcsv(): enclosure must be a single character in %s on line %d 435array(1) { 436 [0]=> 437 string(15) "&water&:&fruit&" 438} 439int(16) 440bool(false) 441 442-- Testing fgetcsv() with file opened using rt mode -- 443 444Notice: fgetcsv(): delimiter must be a single character in %s on line %d 445 446Notice: fgetcsv(): enclosure must be a single character in %s on line %d 447array(1) { 448 [0]=> 449 string(15) "&water&:&fruit&" 450} 451int(16) 452bool(false) 453 454-- Testing fgetcsv() with file opened using r+ mode -- 455 456Notice: fgetcsv(): delimiter must be a single character in %s on line %d 457 458Notice: fgetcsv(): enclosure must be a single character in %s on line %d 459array(1) { 460 [0]=> 461 string(15) "&water&:&fruit&" 462} 463int(16) 464bool(false) 465 466-- Testing fgetcsv() with file opened using r+b mode -- 467 468Notice: fgetcsv(): delimiter must be a single character in %s on line %d 469 470Notice: fgetcsv(): enclosure must be a single character in %s on line %d 471array(1) { 472 [0]=> 473 string(15) "&water&:&fruit&" 474} 475int(16) 476bool(false) 477 478-- Testing fgetcsv() with file opened using r+t mode -- 479 480Notice: fgetcsv(): delimiter must be a single character in %s on line %d 481 482Notice: fgetcsv(): enclosure must be a single character in %s on line %d 483array(1) { 484 [0]=> 485 string(15) "&water&:&fruit&" 486} 487int(16) 488bool(false) 489 490-- Testing fgetcsv() with file opened using a+ mode -- 491 492Notice: fgetcsv(): delimiter must be a single character in %s on line %d 493 494Notice: fgetcsv(): enclosure must be a single character in %s on line %d 495array(1) { 496 [0]=> 497 string(15) "&water&:&fruit&" 498} 499int(16) 500bool(false) 501 502-- Testing fgetcsv() with file opened using a+b mode -- 503 504Notice: fgetcsv(): delimiter must be a single character in %s on line %d 505 506Notice: fgetcsv(): enclosure must be a single character in %s on line %d 507array(1) { 508 [0]=> 509 string(15) "&water&:&fruit&" 510} 511int(16) 512bool(false) 513 514-- Testing fgetcsv() with file opened using a+t mode -- 515 516Notice: fgetcsv(): delimiter must be a single character in %s on line %d 517 518Notice: fgetcsv(): enclosure must be a single character in %s on line %d 519array(1) { 520 [0]=> 521 string(15) "&water&:&fruit&" 522} 523int(16) 524bool(false) 525 526-- Testing fgetcsv() with file opened using r mode -- 527 528Notice: fgetcsv(): delimiter must be a single character in %s on line %d 529 530Notice: fgetcsv(): enclosure must be a single character in %s on line %d 531array(1) { 532 [0]=> 533 string(15) "=water===fruit=" 534} 535int(16) 536bool(false) 537 538-- Testing fgetcsv() with file opened using rb mode -- 539 540Notice: fgetcsv(): delimiter must be a single character in %s on line %d 541 542Notice: fgetcsv(): enclosure must be a single character in %s on line %d 543array(1) { 544 [0]=> 545 string(15) "=water===fruit=" 546} 547int(16) 548bool(false) 549 550-- Testing fgetcsv() with file opened using rt mode -- 551 552Notice: fgetcsv(): delimiter must be a single character in %s on line %d 553 554Notice: fgetcsv(): enclosure must be a single character in %s on line %d 555array(1) { 556 [0]=> 557 string(15) "=water===fruit=" 558} 559int(16) 560bool(false) 561 562-- Testing fgetcsv() with file opened using r+ mode -- 563 564Notice: fgetcsv(): delimiter must be a single character in %s on line %d 565 566Notice: fgetcsv(): enclosure must be a single character in %s on line %d 567array(1) { 568 [0]=> 569 string(15) "=water===fruit=" 570} 571int(16) 572bool(false) 573 574-- Testing fgetcsv() with file opened using r+b mode -- 575 576Notice: fgetcsv(): delimiter must be a single character in %s on line %d 577 578Notice: fgetcsv(): enclosure must be a single character in %s on line %d 579array(1) { 580 [0]=> 581 string(15) "=water===fruit=" 582} 583int(16) 584bool(false) 585 586-- Testing fgetcsv() with file opened using r+t mode -- 587 588Notice: fgetcsv(): delimiter must be a single character in %s on line %d 589 590Notice: fgetcsv(): enclosure must be a single character in %s on line %d 591array(1) { 592 [0]=> 593 string(15) "=water===fruit=" 594} 595int(16) 596bool(false) 597 598-- Testing fgetcsv() with file opened using a+ mode -- 599 600Notice: fgetcsv(): delimiter must be a single character in %s on line %d 601 602Notice: fgetcsv(): enclosure must be a single character in %s on line %d 603array(1) { 604 [0]=> 605 string(15) "=water===fruit=" 606} 607int(16) 608bool(false) 609 610-- Testing fgetcsv() with file opened using a+b mode -- 611 612Notice: fgetcsv(): delimiter must be a single character in %s on line %d 613 614Notice: fgetcsv(): enclosure must be a single character in %s on line %d 615array(1) { 616 [0]=> 617 string(15) "=water===fruit=" 618} 619int(16) 620bool(false) 621 622-- Testing fgetcsv() with file opened using a+t mode -- 623 624Notice: fgetcsv(): delimiter must be a single character in %s on line %d 625 626Notice: fgetcsv(): enclosure must be a single character in %s on line %d 627array(1) { 628 [0]=> 629 string(15) "=water===fruit=" 630} 631int(16) 632bool(false) 633 634-- Testing fgetcsv() with file opened using r mode -- 635 636Notice: fgetcsv(): delimiter must be a single character in %s on line %d 637 638Notice: fgetcsv(): enclosure must be a single character in %s on line %d 639array(1) { 640 [0]=> 641 string(17) "-water--fruit-air" 642} 643int(18) 644bool(false) 645 646-- Testing fgetcsv() with file opened using rb mode -- 647 648Notice: fgetcsv(): delimiter must be a single character in %s on line %d 649 650Notice: fgetcsv(): enclosure must be a single character in %s on line %d 651array(1) { 652 [0]=> 653 string(17) "-water--fruit-air" 654} 655int(18) 656bool(false) 657 658-- Testing fgetcsv() with file opened using rt mode -- 659 660Notice: fgetcsv(): delimiter must be a single character in %s on line %d 661 662Notice: fgetcsv(): enclosure must be a single character in %s on line %d 663array(1) { 664 [0]=> 665 string(17) "-water--fruit-air" 666} 667int(18) 668bool(false) 669 670-- Testing fgetcsv() with file opened using r+ mode -- 671 672Notice: fgetcsv(): delimiter must be a single character in %s on line %d 673 674Notice: fgetcsv(): enclosure must be a single character in %s on line %d 675array(1) { 676 [0]=> 677 string(17) "-water--fruit-air" 678} 679int(18) 680bool(false) 681 682-- Testing fgetcsv() with file opened using r+b mode -- 683 684Notice: fgetcsv(): delimiter must be a single character in %s on line %d 685 686Notice: fgetcsv(): enclosure must be a single character in %s on line %d 687array(1) { 688 [0]=> 689 string(17) "-water--fruit-air" 690} 691int(18) 692bool(false) 693 694-- Testing fgetcsv() with file opened using r+t mode -- 695 696Notice: fgetcsv(): delimiter must be a single character in %s on line %d 697 698Notice: fgetcsv(): enclosure must be a single character in %s on line %d 699array(1) { 700 [0]=> 701 string(17) "-water--fruit-air" 702} 703int(18) 704bool(false) 705 706-- Testing fgetcsv() with file opened using a+ mode -- 707 708Notice: fgetcsv(): delimiter must be a single character in %s on line %d 709 710Notice: fgetcsv(): enclosure must be a single character in %s on line %d 711array(1) { 712 [0]=> 713 string(17) "-water--fruit-air" 714} 715int(18) 716bool(false) 717 718-- Testing fgetcsv() with file opened using a+b mode -- 719 720Notice: fgetcsv(): delimiter must be a single character in %s on line %d 721 722Notice: fgetcsv(): enclosure must be a single character in %s on line %d 723array(1) { 724 [0]=> 725 string(17) "-water--fruit-air" 726} 727int(18) 728bool(false) 729 730-- Testing fgetcsv() with file opened using a+t mode -- 731 732Notice: fgetcsv(): delimiter must be a single character in %s on line %d 733 734Notice: fgetcsv(): enclosure must be a single character in %s on line %d 735array(1) { 736 [0]=> 737 string(17) "-water--fruit-air" 738} 739int(18) 740bool(false) 741 742-- Testing fgetcsv() with file opened using r mode -- 743 744Notice: fgetcsv(): delimiter must be a single character in %s on line %d 745 746Notice: fgetcsv(): enclosure must be a single character in %s on line %d 747array(1) { 748 [0]=> 749 string(21) "-water---fruit---air-" 750} 751int(22) 752bool(false) 753 754-- Testing fgetcsv() with file opened using rb mode -- 755 756Notice: fgetcsv(): delimiter must be a single character in %s on line %d 757 758Notice: fgetcsv(): enclosure must be a single character in %s on line %d 759array(1) { 760 [0]=> 761 string(21) "-water---fruit---air-" 762} 763int(22) 764bool(false) 765 766-- Testing fgetcsv() with file opened using rt mode -- 767 768Notice: fgetcsv(): delimiter must be a single character in %s on line %d 769 770Notice: fgetcsv(): enclosure must be a single character in %s on line %d 771array(1) { 772 [0]=> 773 string(21) "-water---fruit---air-" 774} 775int(22) 776bool(false) 777 778-- Testing fgetcsv() with file opened using r+ mode -- 779 780Notice: fgetcsv(): delimiter must be a single character in %s on line %d 781 782Notice: fgetcsv(): enclosure must be a single character in %s on line %d 783array(1) { 784 [0]=> 785 string(21) "-water---fruit---air-" 786} 787int(22) 788bool(false) 789 790-- Testing fgetcsv() with file opened using r+b mode -- 791 792Notice: fgetcsv(): delimiter must be a single character in %s on line %d 793 794Notice: fgetcsv(): enclosure must be a single character in %s on line %d 795array(1) { 796 [0]=> 797 string(21) "-water---fruit---air-" 798} 799int(22) 800bool(false) 801 802-- Testing fgetcsv() with file opened using r+t mode -- 803 804Notice: fgetcsv(): delimiter must be a single character in %s on line %d 805 806Notice: fgetcsv(): enclosure must be a single character in %s on line %d 807array(1) { 808 [0]=> 809 string(21) "-water---fruit---air-" 810} 811int(22) 812bool(false) 813 814-- Testing fgetcsv() with file opened using a+ mode -- 815 816Notice: fgetcsv(): delimiter must be a single character in %s on line %d 817 818Notice: fgetcsv(): enclosure must be a single character in %s on line %d 819array(1) { 820 [0]=> 821 string(21) "-water---fruit---air-" 822} 823int(22) 824bool(false) 825 826-- Testing fgetcsv() with file opened using a+b mode -- 827 828Notice: fgetcsv(): delimiter must be a single character in %s on line %d 829 830Notice: fgetcsv(): enclosure must be a single character in %s on line %d 831array(1) { 832 [0]=> 833 string(21) "-water---fruit---air-" 834} 835int(22) 836bool(false) 837 838-- Testing fgetcsv() with file opened using a+t mode -- 839 840Notice: fgetcsv(): delimiter must be a single character in %s on line %d 841 842Notice: fgetcsv(): enclosure must be a single character in %s on line %d 843array(1) { 844 [0]=> 845 string(21) "-water---fruit---air-" 846} 847int(22) 848bool(false) 849 850-- Testing fgetcsv() with file opened using r mode -- 851 852Notice: fgetcsv(): delimiter must be a single character in %s on line %d 853 854Notice: fgetcsv(): enclosure must be a single character in %s on line %d 855array(1) { 856 [0]=> 857 string(23) "&""""&:&"&:,:":&,&:,,,," 858} 859int(24) 860bool(false) 861 862-- Testing fgetcsv() with file opened using rb mode -- 863 864Notice: fgetcsv(): delimiter must be a single character in %s on line %d 865 866Notice: fgetcsv(): enclosure must be a single character in %s on line %d 867array(1) { 868 [0]=> 869 string(23) "&""""&:&"&:,:":&,&:,,,," 870} 871int(24) 872bool(false) 873 874-- Testing fgetcsv() with file opened using rt mode -- 875 876Notice: fgetcsv(): delimiter must be a single character in %s on line %d 877 878Notice: fgetcsv(): enclosure must be a single character in %s on line %d 879array(1) { 880 [0]=> 881 string(23) "&""""&:&"&:,:":&,&:,,,," 882} 883int(24) 884bool(false) 885 886-- Testing fgetcsv() with file opened using r+ mode -- 887 888Notice: fgetcsv(): delimiter must be a single character in %s on line %d 889 890Notice: fgetcsv(): enclosure must be a single character in %s on line %d 891array(1) { 892 [0]=> 893 string(23) "&""""&:&"&:,:":&,&:,,,," 894} 895int(24) 896bool(false) 897 898-- Testing fgetcsv() with file opened using r+b mode -- 899 900Notice: fgetcsv(): delimiter must be a single character in %s on line %d 901 902Notice: fgetcsv(): enclosure must be a single character in %s on line %d 903array(1) { 904 [0]=> 905 string(23) "&""""&:&"&:,:":&,&:,,,," 906} 907int(24) 908bool(false) 909 910-- Testing fgetcsv() with file opened using r+t mode -- 911 912Notice: fgetcsv(): delimiter must be a single character in %s on line %d 913 914Notice: fgetcsv(): enclosure must be a single character in %s on line %d 915array(1) { 916 [0]=> 917 string(23) "&""""&:&"&:,:":&,&:,,,," 918} 919int(24) 920bool(false) 921 922-- Testing fgetcsv() with file opened using a+ mode -- 923 924Notice: fgetcsv(): delimiter must be a single character in %s on line %d 925 926Notice: fgetcsv(): enclosure must be a single character in %s on line %d 927array(1) { 928 [0]=> 929 string(23) "&""""&:&"&:,:":&,&:,,,," 930} 931int(24) 932bool(false) 933 934-- Testing fgetcsv() with file opened using a+b mode -- 935 936Notice: fgetcsv(): delimiter must be a single character in %s on line %d 937 938Notice: fgetcsv(): enclosure must be a single character in %s on line %d 939array(1) { 940 [0]=> 941 string(23) "&""""&:&"&:,:":&,&:,,,," 942} 943int(24) 944bool(false) 945 946-- Testing fgetcsv() with file opened using a+t mode -- 947 948Notice: fgetcsv(): delimiter must be a single character in %s on line %d 949 950Notice: fgetcsv(): enclosure must be a single character in %s on line %d 951array(1) { 952 [0]=> 953 string(23) "&""""&:&"&:,:":&,&:,,,," 954} 955int(24) 956bool(false) 957Done 958