Recall & Review
beginner
What PHP function checks if a file exists?
The
file_exists() function checks if a file or directory exists at the specified path.Click to reveal answer
beginner
How do you check if a path is a directory in PHP?
Use the
is_dir() function to check if the given path is a directory.Click to reveal answer
beginner
What function returns the size of a file in bytes?
The
filesize() function returns the size of a file in bytes.Click to reveal answer
beginner
How can you check if a file is readable in PHP?
Use the
is_readable() function to check if the file can be read.Click to reveal answer
beginner
What does
is_file() check in PHP?It checks if the given path exists and is a regular file (not a directory).
Click to reveal answer
Which PHP function checks if a file or directory exists?
✗ Incorrect
file_exists() returns true if the file or directory exists.What does
is_dir() return if the path is a file?✗ Incorrect
is_dir() returns false if the path is not a directory.Which function gives the size of a file in bytes?
✗ Incorrect
filesize() returns the size of the file in bytes.How to check if a file can be read by PHP?
✗ Incorrect
is_readable() returns true if the file is readable.What does
is_file() check?✗ Incorrect
is_file() returns true only if the path is a regular file.Explain how to check if a file exists and is readable in PHP.
Think about first confirming the file is there, then if you can read it.
You got /3 concepts.
Describe the difference between
is_file() and is_dir().One checks files, the other checks folders.
You got /3 concepts.