Ok, this is a total newbie question I know, so be kind? cringes
I'm starting to play with opening files and writing to them. I got further than I thought I would, to be honest. I created the following...
I have a file that contains, ona single line
blah blah blah
I wrote the following script
<?
$myfile= fopen("file", "r");
$myline= fgets($myfile, 255);
echo $myline;
fclose($myfile);
$myline2 = "$myline blah";
$fp = fopen("file","w");
fwrite($fp, $myline2);
fclose($fp);
?>
to add a blah at the end of the line each time it's run. However, it's writing out the line as
blah blah blah
blah
Which tells me there is probably a newline character in there somewhere that I need to strip out of $myline before I write $myline2, but I'm having trouble locating the function to do it. Can someone advise please?