Read content of a file to string (in this example, we echo it):

// Get text from file
function get_text($text_filename) {
 if ($text_filename != "") {
  $text = "";
  $text_file = fopen($text_filename, "r");
  while (!feof($text_file)) {
      $text = $text . fgets($text_file, 4096);
  }
  fclose($text_file);
  if ( $text != "" ) {
    echo $text;
  }
 }
}

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *