How to use Filesystem fwrite in PHP

In this article I am going to explain about fwrite function in PHP.
  • 1283

PHP fwrite() Function

The filesystem fwrite function is used to write the contents in an open file. The function returns the number of bytes on success or false on failure.

Syntax of fwrite function

fwrite(file, string, length)

Parameters in fwrite 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 maximum number of bytes to write.

Example of filesystem fwrite function

<html>

<body>
 

<?php

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

echo fwrite($file, "MCN_Soluation");

fclose($file);

?>
 

</body>

</html>

 

Output:

fwritefunctionphp.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.