I want my function to return an associative array, but I don't want to have to use list() when calling upon it. I want this to work:
function getMyArray(){
return array("fruit" => "apple", "vegetable" => "carrot", "berry" => "raspberry");
}
$myArray = getMyArray();
// I want this to output "apple", "carrot" and "raspberry".
echo $myArray['fruit'], $myArray['vegetable'], $myArray['berry'];
You see, I want to be able to add new elements to the return statement, without having to edit every place where I call upon the function. That's why I think it would be impractical to use list() - I don't always know which elements I will be getting.