php doesn't handle function returns like some other languages do
this is invalid syntax since php doesn't consider the function to be an array:
echo setArray()["Orange"];
you have to set a variable as the returned array then call an index from the variable
$arr = setArray();
echo $arr["Orange"];
to shorten things up you could also just return the created array from the function without assigning it a variable
function setArray(){
return array("Some", "Array", "Data");
}