How to open a file for writing?
Answer / Akash Mishra
To open a file for writing in PHP, use the `fopen()` function with the `'w'` mode:
```php
$myFile = fopen('filename.txt', 'w');
if (!$myFile) {
die('Unable to open file: ' . $myFile);
}
// write some content here...
fclose($myFile);
```
| Is This Answer Correct ? | 0 Yes | 0 No |
Does facebook use php framework?
How will you create a mysql database using php ?
Explain what are some new features introduced in php7?
What are the differences between include() and include_once () functions?
Write a program using while loop in php?
How to concatenate two strings together in php?
Swap two variables value without using third variable in php ?
What is inheritance in php with example?
What is session_start () in php?
What is array function in javascript?
How to remove all duplicate values in array in php?
How do I run a php script in windows?