$output = exec('ls -l'); echo $output; // shows a list of all files and folders in the current directory
$command = 'mkdir new_folder'; $output = exec($command, $output_array, $return_var); if ($return_var === 0) { echo 'Folder created successfully.'; } else { echo 'Error creating folder.'; }In this example, the `exec()` function executes the `mkdir new_folder` command to create a new folder. The `$output_array` parameter is used to store the output of the command, and the `$return_var` parameter stores the exit code of the command. If the `$return_var` is equal to 0, the command executed successfully and the message "Folder created successfully" is displayed. Package Library: The PHP `exec()` function is a core PHP function and does not require any external package library.