Which of the following are ways to create a file in PHP?
- fopen() with 'w' mode
- file_put_contents()
- touch()
- mkdir()
In PHP, you can create a file by using the fopen() function with the appropriate file path and 'w' mode, which will create the file if it doesn't exist. Additionally, you can use the file_put_contents() function to create a file and write contents to it. The touch() function is used to change file timestamps, and the mkdir() function is used to create directories, not files.
Loading...
Related Quiz
- Which of the following are true about the elseif statement in PHP?
- How is the comparison of objects done in PHP?
- What is the purpose of the mysqli_connect() function in PHP?
- What is the scope of a variable that is declared within a PHP function?
- What is the purpose of the assignment operators in PHP?