What are the best practices for iterating through an array in PHP using foreach loop?

When iterating through an array in PHP using a foreach loop, it is important to follow some best practices to ensure efficient and effective code execution. Some of the best practices include initializing the loop with the array variable, using a meaningful variable name for the current element, and avoiding modifying the array within the loop to prevent unexpected behavior.

// Example of iterating through an array using foreach loop with best practices
$numbers = [1, 2, 3, 4, 5];

foreach ($numbers as $number) {
    // Use a meaningful variable name for the current element
    echo $number . "\n";
}