Hello.
There is a script that writes information to a file, and there is another (script) that deletes it when needed.
I need a function to remove spaces and line breaks directly from the file, I tried trim() , but this is sort of for the line, not for the file itself.
Would you recommend that?
Maybe I forgot about some kind of function. Example
if(file_put_contents($admfile, PHP_EOL . $admexphrase, FILE_APPEND)) { echo "succesadm"; } // write to file with line break
// what happened
1- <p><a href="admintour110.php">tour23.php</a></p> 2- <p><a href="admintour115.php">tour24.php</a></p> 3- <p><a href="admintour120.php">tour25.php</a></p> // this is what happens when you delete this line
1- <p><a href="admintour110.php">tour23.php</a></p> 2- <p><a href="admintour115.php">tour24.php</a></p> 3- // when re-recording
1- <p><a href="admintour110.php">tour23.php</a></p> 2- <p><a href="admintour115.php">tour24.php</a></p> 3 - 4- <p><a href="admintour120.php">tour25.php</a></p> // if you delete the last line again and overwrite it will be released
// when re-recording
1- <p><a href="admintour110.php">tour23.php</a></p> 2- <p><a href="admintour115.php">tour24.php</a></p> 3- 4- 5- <p><a href="admintour120.php">tour25.php</a></p> // delete with str_replace
$admstring = '<p><a href="admintour120.php">tour25.php</a></p>'; $admcontold = array("$admstring"); $admcontnew = array(""); $admphrase = str_replace($admcontold, $admcontnew, $admcont); if(file_put_contents($admlist, $admphrase)) { echo "succes page\n"; }
$admstring = '<p><a href="admintour120.php">tour25.php</a></p> . PHP_EOL';- E_p