Are there any specific performance considerations to keep in mind when working with arrays in PHP, especially when dealing with nested structures?

When working with arrays in PHP, especially nested structures, it's important to consider performance implications. One key consideration is the use of functions like foreach loops, which can be less efficient than traditional for loops when dealing with large arrays. Additionally, minimizing the number of nested loops and avoiding unnecessary array manipulations can help improve performance.

// Example of using a for loop instead of foreach for better performance
$array = [1, 2, 3, 4, 5];
for ($i = 0; $i < count($array); $i++) {
    echo $array[$i] . " ";
}