What are the potential pitfalls of nesting multiple loops to handle a timestamp range in PHP?

Nesting multiple loops to handle a timestamp range in PHP can lead to inefficient code and potential performance issues. A more efficient approach would be to use a single loop and calculate the timestamps within that loop.

$start_timestamp = strtotime('2022-01-01');
$end_timestamp = strtotime('2022-01-31');

for ($timestamp = $start_timestamp; $timestamp <= $end_timestamp; $timestamp += 86400) {
    echo date('Y-m-d', $timestamp) . "\n";
}