Get distinct values from an array using php
Does anybody know how to get the distinct values from an array usi开发者_如何学Gong PHP:
This is my MySQL query:
SELECT DISTINCT url_id, time_spent FROM library ORDER BY url_id
Not really sure which you want to do, the "distinct" should do it along with a group by in SQL.
But, if you want to somehow go through the data afterwards use array_unique.
Your question is unclear
Take a look at array_unique()
.
精彩评论