How can the system() function in PHP be utilized effectively to execute commands and save output?

To utilize the system() function in PHP effectively to execute commands and save output, you can use the backticks operator (`) or the shell_exec() function to capture the output of the command and store it in a variable for further processing or display.

// Execute a command using system() and capture the output
$output = system('ls -l');
echo $output;