Q
Which PHP function returns the parent directory of a file?

Answer & Solution

Answer: Option D
Solution:
The dirname() function returns the parent directory of a file path, such as extracting '/path/to' from '/path/to/file.txt'.
Related Questions on Average

Which superglobal variable in PHP is used to handle file uploads?

A). $_FILES

B). $_POST

C). $_GET

D). $_REQUEST

What PHP function is used to delete a file?

A). unlink()

B). remove()

C). delete()

D). file_delete()

What PHP function retrieves information about a file?

A). stat()

B). fileinfo()

C). fileinfo_stat()

D). fileinfo()

What does the PHP function touch() do?

A). Updates the access and modification time of a file

B). Creates a new file

C). Deletes a file

D). Changes file permissions

Which PHP function removes a directory?

A). rmdir()

B). removedir()

C). deletedir()

D). unlink()

What is the purpose of the PHP function umask()?

A). Sets the default file permissions for new files

B). Changes file ownership

C). Checks file existence

D). Removes a file

Which PHP function sets the file pointer to the beginning of a file?

A). rewind()

B). reset()

C). fseek()

D). file_start()

Which PHP function is used to handle file uploads?

A). move_uploaded_file()

B). copy()

C). rename()

D). fopen()

What attribute is required in HTML forms for file uploads?

A). enctype='multipart/form-data'

B). method='file'

C). enctype='application/x-www-form-urlencoded'

D). enctype='text/plain'

Which PHP function checks if a file or directory exists?

A). file_exists()

B). is_file()

C). exists()

D). check_file()