Use fgetc() to read a single character from a file


SUBMITTED BY: henry1874w

DATE: June 21, 2017, 11:27 p.m.

FORMAT: Text only

SIZE: 252 Bytes

HITS: 197

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <?php
  5. $myfile = fopen("webdictionary.txt", "r") or die("Unable to open file!");
  6. // Output one character until end-of-file
  7. while(!feof($myfile)) {
  8. echo fgetc($myfile);
  9. }
  10. fclose($myfile);
  11. ?>
  12. </body>
  13. </html>

comments powered by Disqus