/    Sign up×
Community /Pin to ProfileBookmark

Can’t fwrite to next line

Should be something small, anyone know why it doesn’t go to newline?

[code]
$string = ‘Merrychristmas’;
$statfile = fopen(“stats.txt”, “w”) or exit(“Unable to open file!”);
fwrite($statfile,$string.”n”);
fwrite($statfile,”…..”);
[/code]

Everything appears on one line.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@bubakJun 24.2009 — Try

[code=php]fwrite($statfile,$string."nr");[/code]
Copy linkTweet thisAlerts:
@PembarauthorJun 24.2009 — Try

[code=php]fwrite($statfile,$string."nr");[/code][/QUOTE]


Nope. Same thing.
Copy linkTweet thisAlerts:
@bubakJun 24.2009 — I tried your original code, and it works fine if you open it in anything that is better than regular notepad, such as notepad2 or notepad++.#

To get it to display properly in notepad, I used this:

[code=php]fwrite($statfile,$string."rn");[/code]

Which is the reverse of what I gave you originally.
Copy linkTweet thisAlerts:
@PembarauthorJun 24.2009 — Jeez, you're right. Thanks. I should stop using notepad.
×

Success!

Help @Pembar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...