array to a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

array to a file

Post by jaymoore_299 »

if I have an $myarray = array("one","two","three")
how what do I use as the glue for implode("?", $myarray)
so that when I write this string to a file and view it in notepad each element is on its own line?
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

try this

Post by neophyte »

did you try "\n"
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

I'd say "\r\n" if you use windows, as it would not show up as newlines in notepad etc otherwise. (but \n really does fine if you are not gonna read the file yourself)
Post Reply