// buffer the file into an line by line array
$l = @file("quotes.txt");
// set the seed
srand((double)microtime()*1000000);
// generate a random number
$num = rand(0,count($l) - 1);
// return a line from the array
echo($l[$num])
as to keeping the words under 5 characters, if the list is already that small you will have no problems, otherwise check with strlen() see what you get and if greater then five decide what to do.