www.webdeveloper.com
Results 1 to 2 of 2

Thread: How do I get newline characters

  1. #1
    Join Date
    Oct 2005
    Posts
    29

    How do I get newline characters

    Im tyring to output information to a file. I want to have a newline character at the end of each line so that the next string that is written to the file starts on the next line. I coded it as below but it didnt work, I get all the outputs on the same line with the \n in between each string. What did I do wrong?

    $writefile1='Name:'.$name.' / Address:'.$address.'\n';
    $writefile2='Question: '.$question.' submitted on '.$dte.'\n';
    fputs($fp,$writefile1);
    fputs($p,$writefile2);

    where $fp is the file that is opened for writing to.

  2. #2
    Join Date
    Feb 2005
    Location
    BC, Canada
    Posts
    1,098
    "\n" is a newline
    '\n' is not
    Corn is no place for a mighty warrior!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles