Find and replace duplicates in Array

后端 未结 4 1090
小蘑菇
小蘑菇 2021-01-13 20:14

I need to make app with will fill array with some random values, but if in array are duplicates my app not working correctly. So I need to write script code which will find

4条回答
  •  天涯浪人
    2021-01-13 20:35

    $uniques = array();
    foreach ($charset as $value) 
       $uniques[$value] = true;
    $charset = array_flip($uniques);
    

提交回复
热议问题