How can the $ausfuehrung_array variable be properly initialized and cleared within the loop to avoid data overlap?

To properly initialize and clear the $ausfuehrung_array variable within the loop to avoid data overlap, you can initialize it as an empty array at the beginning of each iteration and clear it at the end of each iteration. This ensures that each iteration starts with a clean array and does not retain data from previous iterations.

// Initialize and clear $ausfuehrung_array within the loop
foreach ($some_data as $data) {
    $ausfuehrung_array = []; // Initialize as empty array at the beginning of each iteration

    // Process $data and populate $ausfuehrung_array

    // Clear $ausfuehrung_array at the end of each iteration
    $ausfuehrung_array = []; 
}