Nov 09 2009

Load File into a String

Category: Phpadmin @ 1:08 pm

Simple old function to load a file into a string.


$s = loadStrFile("file.txt");

function loadStrFile($filename) {
	$handle = fopen ($filename, "rb");
	$contents = fread ($handle, filesize ($filename));
	fclose ($handle);
	return $contents;
}
  • Share/Bookmark

Related posts:

  1. How many users are connected?
  2. Copying remote files on your server with PHP
  3. Sending HTML emails with attachment with PHP
  4. Truncate string preserving some words in PHP
  5. Reading mp3 informations with php (id3 tags)

Tags:

One Response to “Load File into a String”

  1. seeal says:

    Really nice blog, nice snippet codes, thx 4 sharing :D

Leave a Reply