<?php
$info = "Hi";
$file = fopen("file.txt","w");
fwrite($file,$info);
fclose($file);
?>
I am currently using the code above to write a value into a text file. However, is it possible to retrieve certain variables that are stored within that text file and just rewrite them instead?
Example:
file.txt
$one = "first";
$two = "second";
$three = "third";
Through PHP code, a specified "variable" in the text file should have its contents changed.
New file.txt
$one = "first";
$two = "hi";
$three = "third";