$myfile = fopen("newfile.txt", "w") or die("Unable to open file!"); fwrite($myfile, "Content to write to file"); fclose($myfile);