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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -