I have a file password.txt where I have two lines
user id
password
I want to open this file and change the second line of it. I only know how to open it and change the entire content but I dont know how to change only the second line.
$filename="files/password.txt";
$fp = fopen($filename, "w+") ;
fwrite($fp, $newpass);
fclose($fp); #close the file
I tried this but unsuccesfully
$lines=file('files/password.txt');
$fp = fopen($lines[1], "w+") ;
fwrite($fp, $newpass);
fclose($fp); #close the file