PHP Echo Random Array and Insert to Database without repeat

后端 未结 4 708
滥情空心
滥情空心 2021-01-29 07:09

I have a code to roll a rand number, and show the winner based on their chance.

    $data = array();
    foreach($getAllUserTicketHistoryJson as $value){
                


        
4条回答
  •  爱一瞬间的悲伤
    2021-01-29 07:52

    The winning ticket number $winner_count is ticket number: {$winner[$winner_count]}

    "; $winners[$round_number][] = $winner[$winner_count]; $winner_count++; } $winner_count = 0; } var_dump($winners); ?>

    $ticket_numbers will be filled from the JSON feed. Each time the main loop is run, the required number of winners are picked, their ticket numbers are removed from the list of potential winners. An array of winners is generated which will be used for entering the winners into the database. Each ticket can only win once.

提交回复
热议问题