I am using array_filter to filter out 0's and nulls' from an array.
Code:
while ($row1 = $sth1->fetch(PDO::FETCH_ASSOC)){
$rows_shared_id[$row1['shared_id']]['shared_id'] = $row1['shared_id'];
}
$erows_shared_id = array_filter($rows_shared_id);
foreach($erows_shared_id as $evalue){
echo $evalue['shared_id'] . "<br>";
}
The results, without array_filter, have multiple cells with a value of 0, or null. With array_filter, it filters out all 0's and nulls, except for the first of each. So, I am left with an array with one 0 and one null value. Why is it deleting all, but the first and how do I fix it? Thanks!