2. Array Syntax (Logic Error) (Codecademy Logic Flaw)


#1

$array = array("Egg", "Tomato", "Beans" );
$array[] = "Chips";
$array[] = "Sausage";

These statements end up adding elements to the array $array. However, upon hitting submit, it does not recognize that five elements have been added to the array. It seems like the logic is only checking to see whether or not you literally typed Chips and Sausage into the $array assignment statement instead of checking the content of the array.


#2

It does say,

     // Add your array elements after
     // "Beans" and before the final ")"

Further in the testing may be different. Let us know if the empty index append doesn't work in other lessons. I don't recall it coming up in any. Thanks for bringing this up.