Jump to content

Problem fwrite()/line escape error.


lszanto

Recommended Posts

I have been learning about file commands and such and was having a go at writing to files useing fwrite() but for some reason even if I entered \n at the end of a line it would not write to the text file with a line break but it would just leave everything on the same line, the script is below and all help is appreciated.

[code]<?php

$file = "myfile.txt";

$fh =  fopen($file, 'w') or die("Could not create file");
fwrite($fh, "lszanto\n");
fwrite($fh, "admin\n");
fwrite($fh, "user\n");
fclose($fh);

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/32018-problem-fwriteline-escape-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.