i have a text file that's update all the time. i need to get the last word from it. how can i do that?
$fp = fopen("textfile.txt","r"); $file = fread($fp,filesize("textfile.txt")); fclose($fp);
preg_match("/ ([\n]*)$/",$file,$parts); $last_word = $parts[1];
That should do the trick, but I have not tested it...
Hope this helps.
-Josh
but i won't use it because i allready recieved a working code on another forum. thanks anyway!!!