Annotation of embedaddon/php/ext/standard/tests/file/fgetcsv_variation15.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>