I have a code to roll a rand number, and show the winner based on their chance.
$data = array(); foreach($getAllUserTicketHistoryJson as $value){
Change your code with
for($i=0;$i<2;$i++) { chance($getAllUserTicketHistoryJson[rand(0,count($getAllUserTicketHistoryJson))]).''; } function chance($arrWinner = array()){ // the array for winner is echo " Winner array : "; print_r($arrWinner); echo ""; }
Winner array : "; print_r($arrWinner); echo "