How can a PHP script effectively create and delete directories with the appropriate permissions, especially when using FTP clients like ws_ftp?

When creating directories with PHP and using FTP clients like ws_ftp, it is important to ensure that the directories are created with the appropriate permissions to avoid any issues with accessing or deleting them later. To do this, you can use the `mkdir` function in PHP to create the directory and then use the `chmod` function to set the permissions accordingly. Additionally, you can use the `rmdir` function to delete directories when needed.

// Create a directory with appropriate permissions
$dir = 'new_directory';
mkdir($dir, 0755);

// Delete a directory
rmdir($dir);