私は現在、以下のような配列を持っていますが、ショーの結果を一意の配列 (説明) に表示したいだけです。しかし、私は同じ結果を得続けますか?
これが私の配列です:
$taglist = array(5) {
[0]=> array(5) {
["id"]=> string(2) "27"
["page_id"]=> string(2) "18"
["description"]=> string(10) "Web Design"
["slug"]=> string(10) "web-design"
["visibility"]=> string(7) "visible"
}
[1]=> array(5) {
["id"]=> string(2) "29"
["page_id"]=> string(2) "18"
["description"]=> string(3) "Tutorials"
["slug"]=> string(3) "tutorials"
["visibility"]=> string(7) "visible"
}
[2]=> array(5) {
["id"]=> string(2) "31"
["page_id"]=> string(2) "21"
["description"]=> string(3) "tag"
["slug"]=> string(3) "tag"
["visibility"]=> string(7) "visible"
}
[3]=> array(5) {
["id"]=> string(2) "32"
["page_id"]=> string(2) "21"
["description"]=> string(10) "Web Design"
["slug"]=> string(10) "web-design"
["visibility"]=> string(7) "visible"
}
}
これが私の時間です:
$items = array();
$results = $taglist;
foreach ($results as $result)
{
$items[]= $result['description'];
$items = array_unique($items);
}
echo '<ul>';
while ($tag_item = current($items))
{
echo '<li><a href="/'.$page['slug'].'/tag/'.$tag_item['slug'].'/">'.$tag_item['description'].'</a></li>';
next($items);
}
echo '</ul>';