I worked on a project in that project we have to create folders and then files in that folders. is_dir is a function that checks whether a directory exists or not. mkdir creates a driectory, file_put_contents is a function that create file and places contents in that file.
Following the example code.
$file_name = "files/first.html";
$text = "This is my first file";