如果一个数组中有元素的值相同,那么你可能想要去除重复的元素:
$result = array_unique($result);
注意,array_unique的处理方式是删除重复的元素,但并不改变剩下元素的指针,所以遍历时不能再以指针递增或递减的方式来进行,而应该用foreach:
foreach ($result as $i) { echo($i); }
Tags:
Name
Mail (will not be published)
Website
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">
No Responses
Leave a Response