当我做
foreach($hugeobject as $k => $obj){
echo $obj->userid . " = " . $obj->itemid."<br/>";
}
结果如下:
147099 = 594088
147099 = 594086
147099 = 594085
147099 = 594082
147099 = 594083
147099 = 594089
161676 = 594091
196351 = 593971
196351 = 593904
196387 = 593894
196382 = 593892
196382 = 593891
196382 = 593889
196382 = 593888
196351 = 593887
196351 = 593865
196351 = 593864
196722 = 593798
196351 = 593795
196351 = 593794
196351 = 593793
196351 = 593792
196722 = 593790
196351 = 593789
目标是仅显示这些:
147099 = 594088
161676 = 594091
196351 = 593971
196382 = 593892
196722 = 593798
我尝试使用array_unique()
甚至将其与array_map()
and结合使用serialize()
……但都没有帮助。那么我该怎么做呢?