How does the behavior of the "flush()" function differ between PHP versions, particularly before and after PHP 5.2?

In PHP versions before 5.2, the `flush()` function did not work properly with output buffering, causing issues with streaming data to the browser in real-time. To solve this issue, you can manually flush the output buffer using `ob_flush()` before calling `flush()`.

ob_start();
for ($i = 0; $i < 10; $i++) {
    echo "Streaming data...<br>";
    ob_flush();
    flush();
    sleep(1); // Simulate some processing time
}
ob_end_flush();