I want to save result for looping with enter with this code
$str = '';
for( $i = 1; $i <= 10; $i++ ) {
$str .= $i;
}
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = $str . "\n";
fwrite($myfile, $txt);
fclose($myfile);
but the result is
12345678910
I want the result is like
1
2
3
4
5
6
7
8
9
10
then I try to use this script
$str = '';
for( $i = 1; $i <= 10; $i++ ) {
$str .= $i . "<br>";
}
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = $str . "\n";
fwrite($myfile, $txt);
fclose($myfile);
the result like
1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>
anyone can help me to fix this script please ?
– Maninderpreet Singh Jul 15 '16 at 07:42