The php script displays the results on screen, but does not export the results to a text file. Doing php c:\myscript.php > output.txt
works, but does not contain the line breaks (as opposed to the way it appears on screen).
What I am missing here to export the results to a text file?
The script that works on screen with command line:
<?php
$list1 = array('a1', 'a2', 'a3');
$list2 = array('b1', 'b2',);
$list3 = array('c1', 'c2', 'c3');
foreach ($list1 as $i) {
foreach ($list2 as $j) {
if ( $j == $i ) { continue; }
foreach ($list3 as $k) {
if ( $k == $j ) { continue; }
if ( $k == $i ) { continue; }
echo "$i$j$k
";
}
}
}
?>
I tried to insert this at the end, but getting error.
$sListText = file_get_contents("output.txt");
echo nl2br($sListText);
I tried this, getting empty text file:
$output = null;
foreach....
file_put_contents("output.txt", $output, FILE_APPEND);