How can we create a file using php script ?

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).)

Create a File using fopen()
<?php
$fileName = “testFile.txt”;
$fileHandle = fopen($fileName , ‘w’) or die(“can’t open file”);
fclose($fileHandle );
?>