I am trying to remove string from a .txt file in PHP, and when I do that it leaves blank space. What I tried:
$content = file_get_contents('../admin/accounts.txt');
$content = str_replace('line3', '', $content);
file_put_contents('../admin/accounts.txt', $content);
File before edit:
line1
line2
line3
line4
line5
File after edit:
line1
line2
line4
line5
I want to remove that exact whitespace and file to look like:
line1
line2
line4
line5