Welcome to DevelNet, a code gallery for creating, saving and sharing all kinds of code snippets.

PHP — Save text in file

Posted On: Wednesday, January 14, 2015 at 7:33 PM

Save text in file with php

$save_text = "text data text data";

// create filename.txt file
$fp = fopen("filename.txt", "w");

// Write the text stired in $save_text variable
fwrite($fp, $save_text);

// Close the file