$your_data = "This is the data to be stored in the text file.";// Open the file and erase the contents if any$fp = fopen("textfile_name.txt", "w");// Write the data to the filefwrite($fp, $your_data);// Close the filefclose($fp);?>