Answer the question
In order to leave comments, you need to log in
How to remove the last character from a file?
The file is large, so this method (line operations) will not work:
$f=fopen($file, 'r');
$fcontent=fread($f); //нельзя загружать файл в память - он может не влезть или скрипт будет медленно работать
fclose($f);
$f=fopen($file, 'w');
fwrite($f, substr($fcontent, 0, -1));
fclose($f);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question