How can the use of explicit numerical indices be optimized when working with arrays in PHP?

When working with arrays in PHP, the use of explicit numerical indices can be optimized by using a loop to iterate through the array and assign values to each index. This ensures that all indices are set explicitly and in a systematic way, which can make the code more readable and maintainable.

$myArray = [];
for ($i = 0; $i < 10; $i++) {
    $myArray[$i] = $i * 2;
}
print_r($myArray);