谁能告诉我为什么这不能按预期工作?
<?php
$merchant_string = '123-Reg|Woolovers|Roxio|Roxio|BandQ|Roxio|Roxio|Big Bathroom Shop|Roxio|Robert Dyas|Roxio|Roxio|PriceMinister UK|Cheap Suites|Kaspersky|Argos|Argos|SuperFit|PriceMinister UK|Roxio|123-Reg';
$merchant_array = explode('|', $merchant_string);
for($i = 0; $i<count($merchant_array); $i++)
{
$merchant_array = array_unique($merchant_array);
echo $merchant_array[$i] . '<br />';
}
?>
我得到的结果是:
Woolovers
Roxio
BandQ
Big Bathroom Shop
Robert Dyas
我想要的只是重复的东西消失了:|