<?php
$h=fopen("text1.txt",'w');
fwrite($h,"first line of the text1 file (1)\n second line of text1 file (2)\n 3rd line of text1 file.(3)\n");
fclose($h);
echo "your file 1 is created and write successfully"."<br>";
?>
<?php
$h1=fopen("text2.txt",'w');
fwrite($h1,"4th line which is 1st line of text2.(4)\n5th line which is 2nd of text2 (5)\n 6th which is 3rd of text2.(6)\n");
fclose($h1);
echo "your file 2 is created and write successfully"."<br>";
?>
<?php
$h2=fopen("text3.txt",'a');
$h=fopen("text1.txt",'r');
$r=fread($h,filesize("text1.
txt"));$h=fopen("text1.txt",'w');
fwrite($h,"first line of the text1 file (1)\n second line of text1 file (2)\n 3rd line of text1 file.(3)\n");
fclose($h);
echo "your file 1 is created and write successfully"."<br>";
?>
<?php
$h1=fopen("text2.txt",'w');
fwrite($h1,"4th line which is 1st line of text2.(4)\n5th line which is 2nd of text2 (5)\n 6th which is 3rd of text2.(6)\n");
fclose($h1);
echo "your file 2 is created and write successfully"."<br>";
?>
<?php
$h2=fopen("text3.txt",'a');
$h=fopen("text1.txt",'r');
$r=fread($h,filesize("text1.
fwrite($h2,$r);
fclose($h2);
echo "your text 1 file mearge on text 3 file successfully"."<br>";
?>
<?php
$h2=fopen("text3.txt",'a');
$h1=fopen("text2.txt",'r');
$r1=fread($h1,filesize("text2.
txt"));
fwrite($h2,$r1);
fclose($h2);
echo "your text 2 file mearge on text 3 file successfully"."<br>";
?>
<?php
$h3=fopen("text4.txt",'w');
$h2=fopen("text3.txt",'r');
$count=0;
while(!feof($h2))
{
if($count%2==0){
$r2=fgets($h2);
}
else
{
$r2=fgets($h2);
fwrite($h3,$r2);
}
$count++;
}
?>
No comments:
Post a Comment