How could I break a new line after each execution of write in data into text file?
the file is show records in none new line break:
countryId:20, productId:332, status:1, opId:188, xId:pdgje9876, countryId:20, productId:334, status:0, opId:188, xId:pfgje3455,
and this is the output I needed:
countryId:20, productId:332, status:1, opId:188, xId:pdgje9876,
countryId:20, productId:334, status:0, opId:188, xId:pfgje3455,
$txt = "log.txt";
$fh = fopen($txt, 'a') or die("can't open file");
foreach($obj as $key => $value) {
print "$key => $value<br>";
$stringData = $key.":".$value.", ";
fwrite($fh, $stringData);
}
fclose($fh);
Add
"\n"at every line end.