Can chmod() be used to change the permissions of directories in PHP?

Yes, chmod() can be used to change the permissions of directories in PHP. You can use this function to set the permissions for directories by specifying the directory path and the desired permissions in octal format. Make sure to have the necessary permissions to modify the directory.

// Change permissions of a directory
$directory = '/path/to/directory';
$permissions = 0755; // Example permissions
chmod($directory, $permissions);