So does that mean that you want to get the last 9 lines of a file and store it as a variable.
$file = file("pathtoyourfile");
$count = count($file);
for ($i=$count-10;$i<=$count;$i++) {
$newarray[] = $file[$i];
}
$string = implode(" ", $newarray);
print $string;