Tools, FAQ, Tutorials:
Writing a String to a File with a File Handle in PHP
How To Write a String to a File with a File Handle in PHP?
✍: FYIcenter.com
If you have a file handle linked to a file opened for writing, and you want to write a string to the file, you can use the fwrite() function. It will write the string to the file where the file pointer is located, and moves the file pointer to the end of the string. Here is a PHP script example on how to use fwrite():
<?php $file = fopen("/temp/todo.txt", "w"); fwrite($file,"Download PHP scripts at dev.fyicenter.com.\r\n"); fwrite($file,"Download Perl scripts at dev.fyicenter.com.\r\n"); fclose($file); ?>
This script will write the following to the file:
Download PHP scripts at dev.fyicenter.com. Download Perl scripts at dev.fyicenter.com.
2016-11-27, 1228👍, 0💬
Popular Posts:
Can You Specify the "new line" Character in Single-Quoted Strings? You can not specify the "new line...
How to search for the first match of a regular expression using re.search()? The re.search() functio...
Where to find tutorials on how to create Your Own Functions in PHP? A collection of tutorials to ans...
What is Azure API Management Publisher Portal 2017 version? Azure API Management Publisher Portal is...
What is Azure API Management Publisher Dashboard? Azure API Management Publisher Dashboard is an Azu...