H I O X INDIA
FREE PHP Topics
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Templates 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)
Español Français 中文 Deutsch
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

PHP Topics
Introduction
Syntax
Data Types
Variables
Operators
Control Structures
Functions
Pre-defined Function
Calendar Functions
Date and Time
Array Functions
Array Functions List1
Array Functions List2
Math Functions
PHP Mysql Functions
File Handling
Error Handling
DB Size
PHP Mail
String Tokens
String Functions
String Functions List1
String Functions List2
Session Functions
Cookies Functions
Form Variables
Running PHP from JS
Array To JS
Array to PHP
Encryption
Common Header
Ask Your Doubts
More about PHP
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