I'm working with a txt file and PHP and I need to save data into this txt file, save and open the file is not a problem with file_get_contents and file_put_contents but I have a doubt please help me if you can:
I present the info in this order:
issue info 1
issue info 2
issue info 3
as you can see I show to the user the issues in different lines, but that works when I display that info in the browser but if I open the txt file it shows this:
issue info 1issue info 2issue info3
all in the same line, how can I do in order to save the info into the txt file with the order:
issue info 1
issue info 2
issue info 3
thanks in avance, this is my code by the moment:
$filename = "C:/Users/usuario/Videos/Desktop/prueba.txt";
if(file_exists($filename)) {
$filestring = file_get_contents($filename, NULL, NULL);
$convert = explode("\n", $filestring);
for ($i=0;$i<count($convert);$i++)
{
echo $convert[$i]. "</br>";
}
echo "</br>";
$filestring.= "issue 1"."</br>";
file_put_contents($filename, $filestring);
echo "</br>";
}
else{
die("ese file no existe");
}