Ryze - Business Networking Buy Ethereum and Bitcoin
Get started with Cryptocurrency investing
Home Invite Friends Networks Friends classifieds
Home

Apply for Membership

About Ryze


The PHP developers network

Top [This Network is not currently active and cannot accept new posts]
<- Previous Next ->

598 hits
Jan 15, 2004 2:34 am re: re: Quick question from a beginner
Mrchillisauce
Thanks Carl that worked...

What will \r\n do on Unix though?

> Carl Corliss wrote:
> > Mark Rogers wrote:
>> Hi All,
>>
>>I've just joined this tribe as I started learning PHP yesterday. I am an experienced ASP developer so I am picking things uo quite quick from PHP in easy steps (an excellent book given its under 10 dollars!!)
>>
>>I am using windows 2000 with apache, php and mysql installed.
>>
>>I have written a program that writes lines to a text file.
>>
>>I cannot get it to do a carriage return at the end of the line though... I am using \n but it just comes through as a funny square... is this because \n is for the Unix file format? If so what is a character I can use for carriage return that works in windows (or preferably both windows and unix)?
>-------
>
>Windows: "\r\n"
>Unix: "\n"
>Mac: "\r"
>
>>Another question is, are there many differences in programming PHP on windows and unix? What are the pitfalls I would need to look out for transerring my code from a windows machine to a unix machine?
>----
>
>There are a few - the main one to look out for is when referencing a path on win vs. nix. The best way to do so is to use the forward slash ('/') for both unix and windows as it is recognized by php and dealt with correctly. Ie:
>
>fopen('./subdir/somefile.txt', 'wb');
>
>or - the other correct way:
>
>fopen('.\\subdir\\somefile.txt'. 'wb')
>
>iether way will work under windows, however, the former will work under both (iirc).

Private Reply to Mrchillisauce (new win)





Ryze Admin - Support   |   About Ryze



© Ryze Limited. Ryze is a trademark of Ryze Limited.  Terms of Service, including the Privacy Policy