What are the different methods for creating directories in PHP and why would you choose one over the other?

To create directories in PHP, you can use the `mkdir()` function or the `mkdir()` function with the `recursive` parameter set to `true`. The `mkdir()` function is used to create a single directory, while setting the `recursive` parameter to `true` allows you to create nested directories in one go.

// Method 1: Using mkdir() to create a single directory
$directoryPath = 'new_directory';
mkdir($directoryPath);

// Method 2: Using mkdir() with recursive parameter to create nested directories
$nestedDirectoryPath = 'parent_directory/child_directory';
mkdir($nestedDirectoryPath, 0777, true);