PHP Echo Random Array and Insert to Database without repeat

后端 未结 4 739
滥情空心
滥情空心 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 08:03

    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 "
    "; }

提交回复
热议问题