How can shell_exec() be used in PHP to unzip files on a Linux server?

To unzip files on a Linux server using shell_exec() in PHP, you can use the "unzip" command in a shell command. This function allows you to execute shell commands from within a PHP script. You can pass the unzip command along with the file path of the zip file to shell_exec() to unzip the file.

$zipFile = "path/to/your/file.zip";
$destination = "path/to/extracted/folder/";

$unzipCommand = "unzip $zipFile -d $destination";
shell_exec($unzipCommand);