<!DOCTYPE html>
<html>
<body>
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "Bill Gates\n";
fwrite($myfile, $txt);
$txt = "Steve Jobs\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
</body></html>
その結果、stitermフォルダーにnewfile.txtフォルダーが自動的に作成され、中身は次のようになります。
Bill Gates
Steve Jobs