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


#1


https://www.codecademy.com/courses/web-beginner-en-7I7Xm/0/8?curriculum_id=5124ef4c78d510dd89003eb8#

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.

<html>
    <p>
	<?php
	// 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
sort($got);

	// Randomly select a winner!

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

	// Print the winner's name in ALL CAPS

$winningname=$got($winner);
print strtoupper($winningname);

	?>
	</p>
</html>


Replace this line with your code.


#2

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]


#3

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