How to use Filesystem fputs in PHP

In this article I am going to explain about fputs function in PHP.
  • 1519

PHP fputs() Function

The filesystem fputs function is used to writes to an open file and it also will stop at the end of the file or when it reaches the specified length, which comes first.

Syntax of fputs function

fputs(file, string, length)

Parameters in fputs function

It have three parameter:

Parameter Description
file It specifies the open file to write.
string It specifies the string to write to the open file.
length It specifies the maximum number of bytes to write.

Example of filesystem fputs function

<html>

<body>
 

<?php

$file = fopen("C:\wamp\www\Dinesh\Mcn.txt","w");

echo fputs($file,"Hello r u enjoying with PHP function!");

fclose($file);

?>
 

</body>

</html>

 

Output:

fputsfunctionphp.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.