Null characters and text files help (n00b alert)
Posted: Wed Feb 13, 2008 10:56 am
I am trying to create a script that will create a text file with a list of information. In my code I put a \n into a string every time I want a new line to start. For most doc readers this works fine but when I try to open the file I create in Notepad (The one that comes with Windows) there are square characters where line breaks should be.
Does anybody know how to make it so this does not happen?
Does anybody know how to make it so this does not happen?
Code: Select all
$email_list_string .= "$variable1";
$list_string .= "; ";
$list_string .= "$variable2";
$list_string .= "; ";
$list_string .= "$variable3";
$list_string .= "; \n";
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $list_string);
fclose($fh);