Answers for "create a text file and write to that in php"

PHP
9

write to file php

$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, "Content to write to file");
fclose($myfile);
Posted by: Guest on October-22-2020
1

write file in php

// if not file is there then automatic create and write inside it.
$fptr = fopen('myfile.txt','w');
fwrite($fptr,"i am writing file in this\n");
fwrite($fptr,'writing another line.');
fclose($fptr);
Posted by: Guest on October-12-2021
1

write in a file using php

<?php
$myfile = fopen("file_name.txt", "w") or die("Unable to open file!");
$txt = "Hello world\n";
fwrite($myfile, $txt);
$txt = " Php.\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
Posted by: Guest on June-05-2020

Code answers related to "create a text file and write to that in php"

Browse Popular Code Answers by Language