Bird
0
0

Which of the following is the correct syntax to remove an empty directory named temp in PHP?

easy📝 Syntax Q12 of 15
PHP - File Handling
Which of the following is the correct syntax to remove an empty directory named temp in PHP?
Adelete('temp');
Bremove_dir('temp');
Crmdir('temp');
Drm('temp');
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct function for removing directories

    PHP uses rmdir() to remove empty directories.
  2. Step 2: Check syntax correctness

    The syntax rmdir('temp'); correctly removes the directory named 'temp'. Other options are not valid PHP functions.
  3. Final Answer:

    rmdir('temp'); -> Option C
  4. Quick Check:

    Remove empty folder = rmdir() [OK]
Quick Trick: Use rmdir('foldername') to delete empty folders [OK]
Common Mistakes:
  • Using non-existent functions like remove_dir()
  • Trying to delete non-empty folders with rmdir() without clearing
  • Syntax errors like missing quotes or semicolons

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes