Forum Moderators: coopster

Message Too Old, No Replies

php file write

         

vwsequeira

3:34 pm on Jun 9, 2009 (gmt 0)

10+ Year Member



Hi,

$myFile="/home/test/vin.txt";
$myStr="hello user ,how are you?";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $myStr);

when I run the abv script i can see the following in vin.txt file

hello user
,how are you?

The problem is that the string is not written in one line , please suggest me wht to do to write the string in single line.

penders

3:44 pm on Jun 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The code as you have it should write the string in a single line! Unless... there is a carriage return / linefeed character in your source string to begin with?! Is that definitely a space character after the word 'user'?

vwsequeira

5:44 pm on Jun 9, 2009 (gmt 0)

10+ Year Member



Even if i mention $myStr="hello user how are you" it spilts into 2 lines

mvaz

12:20 pm on Jun 10, 2009 (gmt 0)

10+ Year Member



Welcome vwsequeira, why don't you post your code here as it is, and we'll try to see if it needs any changes to it.