Hello once again @rohit_786
Why you want to print your array two times, when it's not neccessary?
Well, that doesn't matter right now.
$random contains a
integer, so you can't simply pass it to
First, you have to pick a
$winner (for example) out of your array
$family by accessing the array (
$family) at the position which your
So, in your case, just add
$winner = $family[$random]; right under the line in which you declare the
$random-variable, then - at your
print-call - replace
$winner and it should work!
Hope that I could help you
Your code should look like this then:
// Create an array and push on the names
// of your closest family and friends
$family = array();
// Sort the list [ADDED: You don't need to print them..]
// print count($family);
// print join (",",$family);
// Randomly select a winner!
$random = rand(0,count($family) - 1);
$winner = $family[$random];
// Print the winner's name in ALL CAPS