I'm writing an application to change a particular line in an HTML file. I've already been able to find the word I want to replace, but for that, I need the line number to write the new content.
function changeLine(){
$file = fopen('index.html', 'r+');
while(!feof($file)) {
$conteudo = fgets($file);
if($resultado = preg_match("/<form/", $conteudo)) {
echo "Achamos!";
}
}
fclose($file);
}
I would like to know if you can capture the line of the HTML file that has the word '.