PHPでテキストの最後の行を取得

PHPコード:
$rs = 'README.md’;
$fp = fopen($rs, 'r’);

fseek($fp,-1,SEEK_END);

$s = ";
while(($c = fgetc($fp)) !== false)
{
if($c == “\n" && $s) break;
$s = $c . $s;
fseek($fp, -2, SEEK_CUR);
}
fclose($fp);
echo $s;
exit;

PHP

Posted by arkgame