php load dynamic text file?

james150687

New member
I have no problem loading a a text file a usual way:

<?


$ourFileName = "mytext.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
$userData = "username=$username\n";
fwrite($ourFileHandle, $userData);
fclose($ourFileHandle);
?>


thats all fine, but with the following line

$ourFileName = "mytext.txt";

how can i make "mytext.txt" use a variable name? for example = "$myVariable.txt "
 
Back
Top