In PHP, fopen() function is used to open files. (If does not exist,it will create a new file. It also helps to open file for writing(w) and appending(a).)
<?php
$fileName = “testFile.txt”;
$fileHandle = fopen($fileName , ‘w’) or die(“can’t open file”);
fclose($fileHandle );
?>