fgetcsv_variation16.phpt 15 KB

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