|
|
|
หาค่าซ้ำใน Array และตัดค่า 0 ออก ต้อใช้ function อะไรครับ (1,1,0,2,3,2,3) |
|
|
|
|
|
|
|
Code (PHP)
$ar = [1,1,0,2,3,2,3,1,9,9];
$counts = array_count_values($ar);
$result = [];
foreach ($counts as $number => $count) {
if($count > 1) {
array_push($result, $number);
}
}
print_r($result);
|
|
|
|
|
Date :
2018-06-21 14:33:32 |
By :
DK |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
http://php.net/manual/en/function.array-count-values.php
|
|
|
|
|
Date :
2018-06-21 14:34:07 |
By :
DK |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|