php - File Get and put contents to Text file with new line -


i have 2 files

file1.php , file2.php

$hello = file_get_contents("file1.php"); file_put_contents("hello.txt",$hello); 

file1.php contains example texts below

hello \r\n hi \r\n how you. 

what need when put contents hello.txt , want words appear in new line below

hello  hi how you. 

i tried use \r\n , \n nothing works

note: file1.php file_get_contents of page source..i can replace <br> tag \r\n , example. have other complex part do.

i think should put @ end of each line,

then can replace whit :

   str_replace 

function, think work

str_replace('[endofline]', "\r\n", $string); 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -