Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Simple Writing a file issue

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Simple Writing a file issue

Postby rahulalertpay » Wed Sep 18, 2013 11:20 am


i need to save text at top of txt file , which will automatic makes 1st line text to be second line, 2nd line text to be 3rd line... so on.

For example, there is abc.txt file contains text in 1st line = hello

i need to write 1st line = "first"

and then 1st line which was "hello" , it must come to second line automatic.

what changes i need to do in the code below?

$my_file = "help";
$handle = fopen($my_file, 'a');
$ggg = "first";
fwrite($handle, $ggg);
New php-forum User
New php-forum User
Posts: 1
Joined: Wed Sep 18, 2013 11:13 am

Return to PHP coding => General

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.