I am using readfile() to display the contents of some text files. The file path/name is stored in my DB and then I display the text simply by...
readfile($article);
What is the best way to limit the number of characters displayed? ie. leftmost 400 characters. Do I need to convert the file to a string and use string functions or is there an easier way?
Yep...count the characters in the string and go from there...
Thanks Vaaska
Came up with this... Simple and it works.
// $article = filepath $handle = fopen($article, "r"); $content = fread($handle, filesize($article)); fclose($handle); echo substr($content, 0,350); //Limit to 350 char