H I O X INDIA
FREE PHP Topics
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

PHP Topics
Introduction
Common Header
Random Number
Type
Form Variables
Date and Time
PHP Mysql Functions
File Handling
Error Handling
DB Size
PHP Mail
String Tokens
Running PHP from JS
Array To JS
Array to PHP
Encryption
Ask Your Doubts
Feedback





Apending in to a file in php


Topic

How to append in to file using php?



Explanation

It is much similar to file writing. The only difference is that we have to open the file in append mode ('a') instead of write mode ('w').

Step 1:
Writing

E.g: We have a file as test2.txt with write permission


The below code will explain you, how we do it
<?php
$file = "test2.txt"; // Here we define the file path
$open = fopen($file, "a"); // Here we open the file in append mode using the php method fopen()
fwrite($open,"Hai this is test message"); // Here we append in to the file using the method fwrite('instance','message') passing fopen instance and the string as arguments
?>




The Result : view the file test2.txt



others


privacypolicy     licence     sitemap
(c) copyright, 2004 hioxindia.com