A
Anonymous
Guest
Hi,
Can anybody explain me why, when you have:
$file = fopen('file.txt','w+');
$data = '';
for($i=0; $i<11; $i++){
$data .= $i.'='.$i.'\n';
}
fwrite($file, $data);
The output generated to data will be all in one sentence, such as: 1=1\n2=2\n3=3\n and so on?
If, instead, you have $data .= $i.'='.$i."\n";
The output generated is:
1=1
2=2
3=3
Why is this difference?
Thanks in advance
Can anybody explain me why, when you have:
$file = fopen('file.txt','w+');
$data = '';
for($i=0; $i<11; $i++){
$data .= $i.'='.$i.'\n';
}
fwrite($file, $data);
The output generated to data will be all in one sentence, such as: 1=1\n2=2\n3=3\n and so on?
If, instead, you have $data .= $i.'='.$i."\n";
The output generated is:
1=1
2=2
3=3
Why is this difference?
Thanks in advance