How can the use of passthru in PHP be beneficial for displaying real-time output during a process execution?

When executing a long-running process in PHP, it can be beneficial to display real-time output to the user to show progress or status updates. The `passthru` function in PHP can be used to execute an external command and display the output directly to the browser in real-time, without waiting for the process to finish.

<?php

ob_implicit_flush(true);

$command = 'long_running_process.sh';
$handle = popen($command, 'r');

while (!feof($handle)) {
    echo fread($handle, 4096);
    ob_flush();
    flush();
}

pclose($handle);

?>