次のような for ループがあります。
for((int) $i = 0; $i < $number_of_updates; $i++)
{
//query here
$result = mysql_query($query);
list($name) = mysql_fetch_row($result);
$points = 1;
//some functions to execute here... and then
//store results in session to show on other page
$output = $points.' times '.$name;
$_SESSION['item'][] = $output;
}
そして、次のようにビューページに結果を表示します。
foreach (array_unique($_SESSION['item']) as $output)
{
echo ('<p>'.$output.'</p>');
}
次のように、ループから結果をエコーします。
1回フー
1回フー
1 タイムスバー
1回フー
等...
今質問です。重複しないようにこれらの結果を合計するにはどうすればよいですか? 代わりに、次のように表示されます。
3回フー
1 タイムスバー