CRLF in file

From: Date: Sun, 26 Jan 2003 14:13:10 +0000
Subject: CRLF in file
Groups: php.general 
Request: Send a blank email to php-general+get-133168@lists.php.net to get a copy of this message
Hello, I'm having trouble with /r/n when I try to write to a file. Here's my code ; The array I want to write - $ch =array( "$SQL_HOST"=> $SQL_HOST, "SQL_USER"=> $SQL_USER, "SQL_PWD"=>$SQL_PWD); and the code I'm using to write the file $fp = fopen ("newfig.txt", "w"); if (!($fp)) { print ("ERROR file not open!"); exit; } { fputs($fp,$ch); foreach($ch as $key => $val) { fputs($fp,"$$key = $val/r/n"); } fclose ($fp); }; Here's a sample of the file this produces - $host = host/r/n$SQL_USER = user/r/n$SQL_PWD = dbpass/r/n What I want is to have crlf after each var like this - $host = host $SQL_USER = user $SQL_PWD = dbpass I must be doing /r/n wrong. My host is Apache on Sun OS.

« previous php.general (#133168) next »