php - How do I create simple code to select 5 names from input? -


I want to create simple puzzles to select random 5 names from the input.

We say that I want to give a gift for my blog commentators so I submit my name and what I paste in textarea

 $ winner = 'John, Michelle, Peter, Sally, Rooney, Owen, Tweez, Ronaldo, Wayne Rooney, Nanny';   

How to choose winners with PHP or Jpier can be done. I know

First put all input text in an array and then with random Choose value>

test
  $ winArray = explosion (",", $ winner); $ Last winner = array_rand ($ winArray, 5) echo "prefix"; Print_r ($ finalWinner); // Return keys "" Resonates; {Echo $ winArray [$ i] to retrieve the names of the winners for $ (= i = 0; $ i & lt; 5; $ i ++). "& Lt; br & gt;"; }    

Comments