Practice makes perfect,help me guys!


#1

Hello guys. I have been trying to solve this exercise. Even though I read all topics that were opened from other users,I couldn't find a solution.

Here is my code:



<?php
$fam = array();
array_push($fam, "Ali");
array_push($fam, "John");
array_push($fam, "Peter");
array_push($fam, "Alex");
array_push($fam, "Lesley");
sort($fam);
$counted = count($fam);
// Sort the list
$sorted = sort($fam);
// Randomly select a winner!
$choosenPerson = rand (0,$sorted-1);
// Print the winner's name in ALL CAPS
print strtoupper($choosenPerson);
?>


I don't know where I made a mistake.I'm waiting your help as soon as possible.:slight_smile: Have a nice day for all.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.