- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
fwrite() function in PHP
The fwrite() function writes to an open file. It returns the number of bytes written on success, whereas returns False on failure.
Syntax
fwrite(file_pointer, string, length)
Parameters
file_pointer − A file system pointer created using fopen(). Required.
string − The string to be written. Required.
length − Maximum number of bytes to be written. Optional.
Return
The fwrite() function returns the number of bytes written on success, whereas returns False on failure.
Example
<?php $file_pointer = fopen("new.txt","w"); echo fwrite($file_pointer,"This is test string!"); fclose($file); ?>
Output
20
Advertisements