append content of first file into second file - PHP | IProgramX

Slip no. 22. Write a PHP Program to read two file names from user and append content of first file into second file.


PHP file :

<?php
$sourceFname="test.txt";
$fp1=fopen("test.txt","r");
$fp2=fopen("test2.txt","a");
fwrite($fp2,fread($fp1,filesize($sourceFname)));
echo "Data Copied";
?>

Post a Comment

0 Comments