What is the difference between using $zutatfertig[] and $foo[$i] = "bar" to add elements to an array in PHP?

When adding elements to an array in PHP, using $zutatfertig[] will automatically append the new element to the end of the array, while $foo[$i] = "bar" allows you to specify the index where the new element should be added. If $i is not already defined, using $foo[$i] = "bar" will result in an error.

// Using $zutatfertig[] to add elements to an array
$zutatfertig = [];
$zutatfertig[] = "apple";
$zutatfertig[] = "banana";

// Using $foo[$i] = "bar" to add elements to an array
$foo = [];
$foo[0] = "apple";
$foo[1] = "banana";