How can PHP be used to manage file permissions for different user groups in a web application?
To manage file permissions for different user groups in a web application using PHP, you can use the `chmod()` function to set permissions on files and directories. You can specify the permission mode using octal numbers, where 4 is read, 2 is write, and 1 is execute. By setting the appropriate permissions for different user groups (owner, group, others), you can control who can read, write, or execute files in your web application.
// Set file permissions for owner, group, and others
chmod("example.txt", 0644); // Owner can read and write, group and others can read
chmod("example.php", 0755); // Owner can read, write, and execute, group and others can read and execute