Help with fwrite command

by 4 replies
5
Hi,

I am trying to use a PHP file to write another PHP file. I've got most of my code working, but I can seem to write the characters "/n". Every time I do, the PHP file just skips to the next line. I have tried printing "/" and the "n" with two separate fwrite commands, but this still does not work. How do I get around this problem?

Thanks,
#programming #command #fwrite
  • Does \\n work?

    Later,
    Dan
  • It looks like your using the wrong end of line character, as dan says try --> \n in place of /n
  • As you have found, the \n has a special meaning (new line).

    To get around this try:-
    1) Escape the slash '\' by using a double slash '\\', i.e. \\n (as said by Dan above)
    or
    2) Enclose the string in single quotes rather than double quotes.

    PS: I'm assuming here that in your post that you meant \ instead of /

Next Topics on Trending Feed

  • 5

    Hi, I am trying to use a PHP file to write another PHP file. I've got most of my code working, but I can seem to write the characters "/n". Every time I do, the PHP file just skips to the next line. I have tried printing "/" and the "n" with two separate fwrite commands, but this still does not work. How do I get around this problem?