Your code works fine.
Thank you, Avram.
By the way,
if the directory which has the file createFile.php has a sub-directory named "my_subDirectory",
How can I put a "newFile.php" into "my_subDirectory"?
The trial code below doesn't work correctly, but I hope it shows what I want.
file_put_contents(dirname(__my_subDirectory__) . '/' . 'newFile.php', 'contents-of-the-file_in_my_subDirectory');