i am working on a php script. it is as follows:
<?
$a='a b c d e';
$b=explode(" ",$a);
foreach ($b as $c) {
$filename = 'test.txt';
$fp = fopen($filename, "a+");
$write = fputs($fp, $c."/n");
fclose($fp);
}
?>
the output (test.txt) comes as this:
a/nb/nc/nd/ne/n
But I want to get the text file like this:
a
b
c
d
e
can any body tell me how to do this?
Escape sequences are indicated with a
\not/– so you need to use “\n” to put a newline into your string (and file)