In this segment of PHP tutorial, we will learn how to use the fputs() file handling function and its example.
In this segment of PHP tutorial, we will learn how to use the fputs() file handling function and its example.
Syntax
<?php
$file=fopen("c:/rose1/ram.txt","r");
echo "before using
fputs<br>";
echo fread($file,100);
fclose($file);
echo "<br>after
using fputs<br>";
$file1=fopen("c:/rose1/ram.txt","w");
fputs($file1,"we
all are indian");
fclose($file1);
$file2=fopen("c:/rose1/ram.txt","r");
echo "<br>";
echo fread($file2,100);
?>
Output
before using fputs
ram is a good boy
after using fputs
we all are indian