I have a code that reads a file and does a series of functions to it. I do not know very well how I could save the file once its modifications were made in a file.txt. Can you guide me? Here I leave my code
<?php
$fp = fopen("archivo.txt", "r");
$linea = fgets($fp);
echo $linea;
echo '<br>';
echo '<br>';
$texto = " <b><font size=\"4\"> <span style='color:black;font-weight:bold;'>PALABRAS</span><font size=\"6\"></b> ";
echo $texto;
echo '<br>';
echo '<br>';
echo str_word_count(file_get_contents("archivo.txt"));
echo '<br>';
echo '<br>';
$texto = " <b></b> <font size=\"4\"> <span style='color:black;font-weight:bold;'>NUEVO TEXTO</span>";
echo $texto;
echo '<br>';
echo '<br>';
echo eliminarVocales($linea);
function eliminarVocales($frase) {
$vocales = array("a", "e", "i", "o", "u", "A", "I", "O", "U");
return str_replace($vocales, "", $frase);
}
fclose($fp);
?>