Functions Part I - "Function name must be a string"


Hi. I appreciate what a basic query this is but having searched all relevant queries to this exercise I can't figure out why I'm getting the error message in the title. I'm obviously messing up the syntax for retrieving a value from an array (second to last line), but every correct example of this exercise I've seen appears to use the same syntax.

	// Create an array and push on the names
    // of your closest family and friends
    $got=array("Lannister", "Stark", "Bolton", "Targaryen", "Tully");
    array_push($got, "Baratheon", "Greyjoy");
	// Sort the list

	// Randomly select a winner!

$winner = rand(0,count($got)-1);

	// Print the winner's name in ALL CAPS

print strtoupper($winningname);


Replace this line with your code.


To get a value of an array by it's index, you use []. For instance: if ou have an array called $arr and you need the value at index 3, you do it like this: $arr[3]


So it's square brackets not round... $got[$winner]. Thanks - can't believe I didn't see that.