educative.io

Purpose of line 2

what is the purpose of line 1 ?

$array = array();
$array[“foo”] = “bar”;
$array[“bar”] = “quux”;
$array[42] = “hello”;
echo $array[“foo”]; // Outputs “bar”
echo “\n”;
echo $array[“bar”]; // Outputs “quux”
echo “\n”;
echo $array[42]; // Outputs “hello”

(sidenote;line 2 in the course example)Educative: Interactive Courses for Software Developers

Hello @Educative_10,
The first line initializes the array, and the lines after that are to assign values.
Hope this helps